Found I can get the result I want using iCustom.
Why don't you directly subtract the indicator value from what you have calculated? Like:
MiddleLineDif = iMA(NULL, 0, ChannelPeriod, 0, MODE_EMA, PRICE_TYPICAL,1) - iCustom(NULL,0, "Keltner Channel",ChannelPeriod, MODE_EMA,PRICE_TYPICAL, mid,1); UpperLineDif = MiddleLine + (iATR(NULL, 0, ChannelPeriod, 1)*2.25) - iCustom(NULL,0, "Keltner Channel",ChannelPeriod, MODE_EMA,PRICE_TYPICAL, upp,1); LowerLineDif = MiddleLine - (iATR(NULL, 0, ChannelPeriod, 1)*2.25) - iCustom(NULL,0, "Keltner Channel",ChannelPeriod, MODE_EMA,PRICE_TYPICAL, low,1);
But you have to check the sequence of the parameter for iCustom. Beside this compare the definition/code of Keltner channel and your calculation.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi there,
My EA has bands that don't match the values of the bands in an indicator I'm using to test my EA.
The indicator displays the bands as below:
The upper band value of the previous bar to the current bar is:
It's code looks like this:
My EA prints out band values, as below. Since Strategy Tester is set to open prices only, the most recent upper value should be the same as above.
The code for this is:
p.s. I start strategy tester, apply the indicator and compare its values with those printed by my EA.
Can you please help to clarify why the values don't match?
Thankyou thankyou thankyou.