Is there a way to get the value form indicator window in MT4 language ? Suppose I have template with MA based on ATR - can I get the value of current value (ex. ma(atr(nn), 0) programatically or do I heve to count it again in expoert code using iMAonArray ??
Simon
Simon
Anyone has any idea ? Metaquotes - may you please state if there is such a way or not ?
Anyway, I went the other way, and tried the code from demo Custom Indicator: I would like to calculate MA(14) of ATR(14) (see below, changed counted_bars initialisation during debug process). Anyone know why MA_Buffer[0] returns 0 and MA_Buffer[1] returns wrong value (much different than the value on Indicator Window, while ATR_Buffer returns exctly tyhe same values as on Indicator Window)?
[code]
int i,limit;
int counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
double ATR_Buffer[];
ArrayResize(ATR_Buffer, Bars);
double MA_Buffer[];
ArrayResize(MA_Buffer, Bars);
for(i=0; i<limit; i++)
ATR_Buffer[i]=iATR(NULL,0,14,i);
for(i=0; i<limit; i++)
MA_Buffer[i]=iMAOnArray(ATR_Buffer,Bars,13,0,MODE_SMA,i);
ErrorLog("ATR[0] = " + ATR_Buffer[0]);
ErrorLog("ATR[1] = " + ATR_Buffer[1]);
ErrorLog("MA[0] = " + MA_Buffer[0]);
ErrorLog("MA[1] = " + MA_Buffer[1]);
</code>
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
Simon