Profile Picture

How to fire "public override void NewBar()" in less than 1min timeframes

Posted By mike 6 Years Ago

How to fire "public override void NewBar()" in less than 1min...

Message
Posted Monday July 11 2011
Hi! I know this may be a simple question and after some research, I've found a couple ways of approaching it, but nothing simple.

I want the NewBar() method to fire in increments < 1min , so I can run my (multi time frame) strategy more frequently than 1min. Thoughts?

Thanks!!
phg
Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)
Posted Tuesday July 12 2011
Mike,

As I am sure you have looked into, RE offers the ability to set your own frequency? Doesn't that work for you? At sub-minute frequencies it seems you would have to have a tick-stream feed. (I haven't used this capability so I cannot speak from experience.)

-Pete

See also Yahoo group about applying RE.

Posted Tuesday July 12 2011
Hey Pete. Thanks. Yes, I did see that option. However, I'm not sure how to use a custom frequency once created in Tools>Options>Frequencies. I've created 30Sec and 10 second frequencies. However, I do not see them in the drop down where you select your main program frequency. Is there another way to apply these new frequencies so that NewBar is called < 1min?

Thanks!!
phg
Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)
Posted Wednesday July 13 2011
I haven't worked with this myself so I can't speak from experience, but isn't that specified in the code you write? I think there is an example in the archives or on the site, or maybe an example in the documentation or an installed example? I recall seeing something.Or just experiment with it?

-Pete

See also Yahoo group about applying RE.

Posted Wednesday July 13 2011
Thanks Pete! Yes, in my code I work multiple frames on indicators and bars.. absolutely.. it's just the initial firing of NewBar() that i need to get called in < 1 min increments. But I was just just wondering if anyone had a "this is the easiest way to do it" solution from experience. Thanks for replying! I'll figure it out Smile
Posted Tuesday July 19 2011
Figured this one out.. pretty easy. GetFrequency take a TimeSpan object.

public class MySymbolScript : MySymbolScriptBase
{
Frequency ThirtySeconds;
   public override void Startup()
   {
ThirtySeconds = GetFrequency(TimeSpan.FromSeconds(30));
ThirtySeconds.NewBar += ThirtySecondBar;
   }

public void ThirtySecondBar(object sender, SingleBarEventArgs args)
{
OutputMessage("New 30Sec bar: " + args.BarStartTime.ToString());
}
}
phg
Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)Supreme Being (44,861 reputation)
Posted Tuesday July 19 2011
Thanks for posting that Mike. That may come in handy down the road.

(Glad to see you got things working; sorry I wasn't much help.)

-Pete

See also Yahoo group about applying RE.



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems