- ago
I have an issue with drawing lines from within a compiled strategy. When a line is drawn with DrawLine it initially appears in the chart, but soon as you navigate to a position in the chart with the positions navigator after running a back test, the line is removed.

This only occurs for a compiled strategy. The exact same strategy run from the code editor within WL works fine. It also only seems to occur if there are parameters defined in the strategy.

See the code below for an example. If you run that strategy from within WL it works, if you run it as a compiled strategy the lines dissappear. Also, if you run that strategy as a compiled strategy, but without the parameter, it also works fine.

This goes back to at least version WLB46 upto the current version WLB49. In WLB42 this issue did not occur. I don't have the downloads for the versions in between, so I haven't been able to check those.

Could you look into to this?

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript1 { public class MyStrategy : UserStrategyBase {       private int _firstBarOfDay = -1;       private double _dummyParameter = 0.5;       public MyStrategy()       {          AddParameter("Dummy parameter", ParameterType.Int32, 0, 0, 1, 1);       }       //create indicators and other objects here, this is executed prior to the main trading loop       public override void Initialize(BarHistory bars)       {          _dummyParameter = Parameters.FindName("Dummy parameter").AsDouble;       }       //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 (bars.IsFirstBarOfDay(idx))          {             _firstBarOfDay = idx;             if (bars.DateTimes[idx].DayOfWeek == DayOfWeek.Monday)             {                DrawLine(idx, bars.Open[idx], idx + 5, bars.Open[idx], WLColor.Green, 2);                PlaceTrade(bars, TransactionType.Buy, OrderType.Market);             }          }          if (idx == _firstBarOfDay + 10)          {             foreach (var position in OpenPositions)             {                ClosePosition(position, OrderType.Market);             }          }       } } }
0
373
Solved
1 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.62% )
- ago
#1
Yes, I see it too, it's fixed for Build 50.
1
Best Answer

Reply

Bookmark

Sort