Well, I had to stop for a while because NT (64-bit v7) starting crashing.
Went back to look again today, and now on the simplest test, I am getting an index out of bounds error -- I understand these, but cannot figure where this testcase is failing. It is the same test that was working before. The code is patterned off the code in WMA which explicitly handles CurrentBar == 0.
Error on calling 'OnBarUpdate' method for indicator 'Test' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
This is the entire code in Initialize & OnBarUpdate:
protected override void Initialize() { Add(BarsPeriod.Id, BarsPeriod.Value*_basePrime); // guaranteed to be BarsInProgress == 1 Add(new Plot(Color.Orange, Name)); Overlay = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return; // patch for NT design flaw if ( Bars[0] == null || Bars[1] == null) return; if (CurrentBars[x] < _basePrime) return; // Check 2nd data stream for sufficient bars if (BarsInProgress == 0) // NT can only plot from BIP=0 !!! { Value.Set( WMA( Inputs[x], 10 )[0] ); } }
Comment