Test code:
Check it out on a recent IPO such as BIRK... there'll be an "index was out of range" exception.
I didn't check related indicators such as FractalUp, FractalUp(Down)Bar.
It would be nice if the developers can modify the code so that such situations are handled more gracefully.
CODE:
using WealthLab.PowerPack; using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript9 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { ind1 = new FractalDown(bars.Low,2); PlotIndicator(ind1, WLColor.FromArgb(255,255,0,255), PlotStyle.Dots); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { //code your buy conditions here } else { //code your sell conditions here } } //declare private variables below private IndicatorBase ind1; } }
Check it out on a recent IPO such as BIRK... there'll be an "index was out of range" exception.
I didn't check related indicators such as FractalUp, FractalUp(Down)Bar.
It would be nice if the developers can modify the code so that such situations are handled more gracefully.
Rename
Fixed for PowerPack B27.
Thanks.
Your Response
Post
Edit Post
Login is required