- ago
Thus, I want to get the High candles of the previous hour, I run this code on a 1 minute chart:

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.
0
294
Solved
3 Replies

Reply

Bookmark

Sort
Cone8
 ( 25.44% )
- ago
#1
You can't use Transformer indicators on other Transformer Indicators. For C# code, use the BarHistorySynchronizer and TimeSeriesSynchronizer. See the Synchronize() example. It's very straightforward.

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;    } }
1
Best Answer
Glitch8
 ( 11.81% )
- ago
#2
That’s only a Building Block restriction.
1
Cone8
 ( 25.44% )
- ago
#3
Okay, makes sense.
1

Reply

Bookmark

Sort