This morning it did. **shrugs helplessly**
So first, if you mean the line:
if (CurrentBars[0] < 50)
return;
I originally changed all my Swing statements to Swing(2).SwingLowBar(0, 2, 30), but that didn't fix things.
So this morning I implemented your code for the printout (THANK YOU, HUGE HELP! Watching Strategy 401 didn't help much) and then modified it to:
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 70)
return;
Print(string.Format("{0} | CurrentBar: {1} > Swing(2).SwingLowBar(0, 2, 50): {0}", Time[0], CurrentBar, Swing(2).SwingLowBar(0, 2, 50) ));
if (CurrentBar > Swing(2).SwingLowBar(0, 2, 50) && Swing(2).SwingLowBar(0, 2, 50) >= 0)
{
Print(string.Format("{0} | Condition true | Swing(2).SwingLowBar(0, 1, 50): {1}, Low[{1}]: {2}", Time[0], Swing(2).SwingLowBar(0, 1, 50), Low[Swing(2).SwingLowBar(0, 1, 50)]));
Print(string.Format("{0} | Condition true | Swing(2).SwingLowBar(0, 2, 50): {1}, Low[{1}]: {2}", Time[0], Swing(2).SwingLowBar(0, 2, 50), Low[Swing(2).SwingLowBar(0, 2, 50)]));
Print(string.Format("{0} | Condition true | Swing(2).SwingHighBar(0, 1, 50): {1}, High[{1}]: {2}", Time[0], Swing(2).SwingHighBar(0, 1, 50), High[Swing(2).SwingHighBar(0, 1, 50)]));
Print(string.Format("{0} | Condition true | Swing(2).SwingHighBar(0, 2, 50): {1}, High[{1}]: {2}", Time[0], Swing(2).SwingHighBar(0, 2, 50), High[Swing(2).SwingHighBar(0, 2, 50)]));
}
Now it works for some insane reason?
I am glad, but I cannot understand why reducing all Swing() calls to 30 period didn't fix it. Perhaps I overlooked something, I've gone through 11 versions or so trying different things, but it only take one problem.
You have no idea how important this was to me. THANK YOU THANK YOU!!
I know smatterings of 6 different computer languages, and was doing system automations with MATLAB for 3.5 years, but it is really hard to debug anything unfamiliar if it won't even run.
I've saved everything as a .TXT document and will export the strategy for safekeeping, and now I can trying out different commands. Good error messages really matter, and this OnBarUpdate() really doesn't explain stuff.
I did notice it had been plaguing people since NinjaTrader 7... I did try to search the forums for answers before I posted here. So thank you again, Chelsea!

Comment