View Full Version : StrategyPlot() in if(BarsInProgress == 1)
DaVinci
07-01-2008, 12:18 AM
Hi, I have the StrategyPlot() in my strategy working when it is inside if(BarsInProgress == 0), but it will not work inside if(BarsInProgress == 1). Here is the strategyplot line StrategyPlot(0).DrawDot("Flat" + CurrentBar.ToString(),true,0,High[0] + TickSize, Color.GreenYellow);
BarsInProgress == 1 is a different instrument then the 0. So I guess what I am trying to do is, when its in the '1' instrument, to draw on the '0' instrument chart. Is this possible?
NinjaTrader_Josh
07-01-2008, 01:08 AM
Maybe not. Why don't you try doing it in the primary bars context with Highs[1][0] instead of High[0].
DaVinci
07-01-2008, 11:15 AM
Hi Josh, that was how it was originally setup except after stepping through I noticed some events only trigger correctly if the code is also in the second bars array.
Actually, its not where the StrategyPlot plots that is important. Its just that a plot trigger only seems to happen correctly if the code is located within the second bars array event.
E.g., If I have the strategy calculate on bar close, sometimes it seems (based on the output window) that the second bars array calculates before the primary one. Is this behavior correct assuming that each bars array were based on 30 second timeframe, just different instruments? For the most part, primary bars array closes first.
NinjaTrader_Dierk
07-01-2008, 11:36 AM
I might not have the complete picture ... but you can't rely in the sequence of OnBarUpdate being triggered for different series in your scenario, since a tick on secondary series (instrument B) might come in before tick on primary series (instrument A), even when on the same second.
DaVinci
07-01-2008, 07:51 PM
OK. Thats actually the way I thought it would be (event driven, not sequence driven).
So I guess it sounds like the strategyplot can only be called from the BarsInProgress == 0.
NinjaTrader_Dierk
07-01-2008, 11:09 PM
I believe it could be called from any BarsInProgress context. However, restriction as per my post be low applies.