I have a custom indicator that is very similar to keltner channels. I want to add a secondary series to this indicator such that I can overlay it onto a lower timeframe chart, specifically the indicator will calculate based upon a 4hr timeframe and be visible on a 15 minute bar chart. The channels, which should only calculate once every four hours, will look like a horizontal line above or below the 15min price action until the next calculation, and look like a stepwise line if one is to zoom out.
Anyway, I am sorry that I even have to post about this here because I know similar threads have been opened in the past. I have read all of them, and while I think it has gotten me on the right track, I still haven't been able to produce the desired result.
The "SampleSecondarySeriesAsInputSeries" reference sample is what I have based my code on. So per the reference sample, I have added the secondary timeframe, and then in the variables, I specified the BarsArray that the two EMA's should calculate on, like so...
else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Minute, 240); } else if (State == State.DataLoaded) { EMADiff = EMA(ATR(BarsArray[1],(1)), ATRPeriod); EMAClose = EMA(BarsArray[1], Period); }
What else do I need to do? Am I taking the wrong approach based upon the desired results I described in the first paragraph of this post? When I add the indicator to a 15 minute bar chart nothing shows up.
Thank you for reading, hope someone can offer some insight!
Comment