Thus, I want to get the High candles of the previous hour, I run this code on a 1 minute chart:
However, I noticed a problem that manifests itself when there are no 60 minutes in the hour. In this case, the minute candles of the previous hour are taken into account in this hour. As many candles are counted as missing in this hour. For example, the last candle of the day has an end time of 23:50. The compression will use the value 22:51, 22:52, 22:53...22:59. I expect to get the same values that I see on the hourly chart.
Please tell me how to solve this problem.
CODE:
indicatorHigh= new ScaledInd(bars,new SymbolInd(bars,new TimeSeriesIndicatorWrapper(bars.High),bars.Symbol),HistoryScale.Minute60);
However, I noticed a problem that manifests itself when there are no 60 minutes in the hour. In this case, the minute candles of the previous hour are taken into account in this hour. As many candles are counted as missing in this hour. For example, the last candle of the day has an end time of 23:50. The compression will use the value 22:51, 22:52, 22:53...22:59. I expect to get the same values that I see on the hourly chart.
Please tell me how to solve this problem.
Rename
CODE:
using WealthLab.Backtest; using WealthLab.Core; using System.Drawing; namespace WealthScript3 { public class MyStrategy123 : UserStrategyBase { public override void Initialize(BarHistory bars) { _hourly = BarHistoryCompressor.ToMinute(bars, 60); _hourly = BarHistorySynchronizer.Synchronize(_hourly, bars); PlotBarHistory(_hourly, "Price", WLColor.FromArgb(62, 0, 0, 0)); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { double lasthourHigh = _hourly.High[idx]; } BarHistory _hourly; } }
That’s only a Building Block restriction.
Okay, makes sense.
Your Response
Post
Edit Post
Login is required