I'm building a strategy that uses three timeframes. It runs in the 60 minute timeframe (BarsArray[0]) and uses 1 day (BarsArray[1]) and 1 minute (BarsArray[2]) for entries and exits.
Here what's happening. I've reflected a couple of indicators Bollinger, SMA, VOL and VOLMA. Some are reflected and all put on the Strategies chart with AddChartIndicator().
I saw some results that didn't make sense and when I investigated I found that the Bollinger I reflected was using the 60 minute time frame inspite of my explicit declaration to use the daily (BarsArray[1]).
Here's the code:
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Day,1); // BarsArray[1]
AddDataSeries(BarsPeriodType.Minute,1); // BarsArray[2]
StratVOLMA = VOLMA(BarsArray[1], VOLMAPeriod1);
StratVOLMA.Panel = 2;
VOL(BarsArray[1]).Panel = 2;
AddChartIndicator(VOL(BarsArray[1]));
AddChartIndicator(StratVOLMA);
StratSMA50 = SMA(BarsArray[1], SMAPeriod2);
StratSMA50.Plots[0].Brush = Brushes.Magenta;
AddChartIndicator(StratSMA50);
StratBB = Bollinger(BarsArray[1], BBStdDev, BBPeriod);
AddChartIndicator(Bollinger(BarsArray[1], BBStdDev, BBPeriod));
ClearOutputWindow();
}
Even when adding the Bollinger to chart with a specific declaration (and not the reflected StratBB), the chart says I added it with the 60 minute timeframe.
This isn't just showing me the 60 minute on the chart , the value of the reflected variable also corresponds to the 60 minute timeframe.
If I explicitly declare the indicator each time I'm checking values (Bollinger(BarsArray[1], BBStdDev, BBPeriod).Upper[0]) it works as expected.
Not a big deal for indicators with few variables, but reflection is critical for me using some custom indicators with lots of variables.
Let me know if you more info to duplicate this.
Comment