Profile Picture

Last bar not picked up in strategy using timer not NewBar()

Posted By smersh 3 Years Ago

Last bar not picked up in strategy using timer not NewBar()

Message
Posted Thursday December 11 2014
Hi Daniel,

I'm having problems running a system that executes the strategy on a timer rather than on NewBar(). What happens is that the last daily bar of symbols is not seen.

Background:

The reason I have to run from a timer is because I have portfolio level code that has to gather the potential trade signals from each SymbolScript and apply some portfolio logic to determine which signals should be taken (traded)

The timer tick function does this

if (SystemData.LiveMode && !SystemData.InLeadBars)
      SystemData.SynchronizationContext.Send(DoSystemLevelTimerTasks, null);

where DoSystemLevelTimerTasks() is where the work is done;

The problem is that the system does not always "see" the last bar (daily) of all the symbols.

The way it works is that DoSystemLevelTimerTasks() waits until the system is not in LeadBars and then it iterates though all SymbolScripts and checks that Bars.Current.BarStartTime is the start of the last bar (i.e. yesterday)

I find that this is usually the bar from the day *before* the last bar and other times it is the date of the last bar (as it should be).

I can't understand why it is not ALWAYS the last bar. Also I find that of a list of 40 symbols, perhaps only 10 will correctly see the last bar and then restarting the strategy might have all the symbols correct.

Sometimes the last bar will be correctly picked up on the second timer run but not always. The after a few restarts all symbols last bars are correct.

I have Synchonize Bars = false. So it is not the case that perhaps one symbol missing the last bar is causing all symbols to not see their last bar. (I know that it should actually insert "fake" bars for symbols that have no bar where others do)

It's as if the strategy can't reliably move to the last bar for some reason.
Do you have any ideas what's going on?
BTW Live data has nothing to do with the way historical bars are treated correct?

thanks

Edited: Friday December 12 2014 by smersh
Posted Thursday January 08 2015
Hello to anyone interested in this thread. The issue has been resolved. If you would like to know the details please message me.

thx.




Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems