- ago
CODE:
public class MyStrategy : UserStrategyBase { public MyStrategy() : base() { } public override void Initialize(BarHistory bars) { xSMA = new SMA(bars.Close,20); Plot(xSMA,Color.FromArgb(255,0,0,0)); xADX = new ADX(bars,10); *******Line 22****** Plot(xADX,Color.Green); xDIPlus = new DIPlus(bars,10); Plot(xDIPlus,Color.Blue); xDIMinus = new DIMinus(bars,10); Plot(xDIMinus,Color.Red); StartIndex = 20; }


Initialize Exception (TF20210106.A) Line 22 - Index was out of range.Must be non-negative and less than the size of the collection.(Parameter 'index').
at Wealthlab.Indicators.DirectionalMovement..ctor(BarHistory bh, Int32 period)
at Wealthlab.Indicators.ADX.Populate()
at Wealthlab.Indicators.ADX..ctor(BarHistory bh, Int32 period)
at WealthScript7.MyStrategy.INITIALIZE(BarHistory bars) in :line 22
at WealthLab.Backtest.UserStrategyExecutor.PublishError(List`1 symbols)
0
849
4 Replies

Reply

Bookmark

Sort
- ago
#1
Error message confirmed. Looking into it.

P.S. Please upgrade to the latest Build 6 (or Build 7 next week) - the Plot method is deprecated.
0
- ago
#2
Updated to Build 6. Changed "Plot" to "PlotIndicator" and the error persists.
0
- ago
#3
If it helps I get the error when using the S&P500 but not when using the S&P100
0
- ago
#4
The Plot method per se has nothing to do with this error. I just found and fixed the issue. Please look forward to Build 7 next week.

Re: "TF20210106.A". Since the ticker is invalid (and more), it looks like you typed in that error message by hand? Hint: You can copy it to clipboard either by a right click on it or by finding it in Tools > Log Viewer.
0

Reply

Bookmark

Sort