Custom Indicator working on CHART and from SCRIPT - BUT NOT FROM EA
//--- return value of prev_calculated for next call return (rates_total);
Ziheng Zhuang:
Thanks for the reply. Tried that. Did not resolve the problem.
Sameer Shariff:
Thanks for the reply. Tried that. Did not resolve the problem.
Thanks for the reply. Tried that. Did not resolve the problem.
for (int shift = Bars - 1 - MathMax(SlowPeriod, prev_calculated); shift >= 0; shift--) { Buffer1[shift] = SomeMethod(PERIOD_H1, FastPeriod, iBarShift(instrument, PERIOD_H1, time[shift])); Buffer2[shift] = SomeMethod(PERIOD_D1, SlowPeriod, iBarShift(instrument, PERIOD_D1, time[shift])); } //--- return value of prev_calculated for next call return (rates_total);
Ziheng Zhuang:
Still not working. Shift is already in H1 that's why not converting it. This indicator can only be used on H1 chart.Ziheng Zhuang:
return (rates_total); |
|
Sameer Shariff: Still not working. Shift is already in H1 that's why not converting it. This indicator can only be used on H1 chart.
|
|
whroeder1:
| |
|
Hi Whroeder
This is how I am accessing the indicator values from EA:
buffer1Now = iCustom(NULL, PERIOD_H1, "CDI", 0, 0); buffer1Before = iCustom(NULL, PERIOD_H1, "CDI", 0, 1); buffer2Now = iCustom(NULL, PERIOD_H1, "CDI", 1, 0); buffer2Before = iCustom(NULL, PERIOD_H1, "CDI", 1, 1);
This code works as expected from a script - but not from the EA.
WorthyVII: Hi sameer, did you ever solve this? I have exactly the same issue. In my backtest my indicators are all over the place.
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
- Do you really think OP still has the problem after three years?
- Do you really think your code is the same as OPs?

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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 Guys
I have a custom indicator, which works fine when I attach it to a chart. When I attempt to get the values from the indicator, they are retrieved correctly as per the chart, when getting it from a script. If I use the same code that works in the script from an EA - I get values, but they are not the same values as the chart.
OnInit
OnCalculate
Can anyone spot what the problem is?
Like I said, shows fine on chart and can get correct value through iCustom from script attached to chart. But I don't get the same values from the EA.
PLEASE HELP!