I am trying to modify the KeltnerChannel indicator to be able to use with Multi timeframes. Basically I want to plot the KC from a 10 min chart on a 3 min chart.
The code from the KeltnerChannel is straightforward.
But how do I use the EMA with the BarsArray[1] when there is already two parameters needed as below?
i.e.
double offset = EMA(diff, Period)[0] * offsetMultiplier;
with BarArray[1]??
EMA(IDataSeries input, int period)[int barsAgo]
I don't see in any examples how to deal with such a case and am stumped.
My code:
if (BarsInProgress == 0)
{
//diff.Set(High[0] - Low[0]);
diff.Set(Highs[1][0] - Lows[1][0]); // changed from above
//double middle = EMA(Typical, Period)[0];
double middle = EMA(BarsArray[1],Period)[0];
double offset = EMA(diff, Period)[0] * offsetMultiplier;
//double offset = EMA(diff, Period)[0] * offsetMultiplier;
double upper = middle + offset;
double lower = middle - offset;
Midline.Set(middle);
Upper.Set(upper);
Lower.Set(lower);
}
Comment