Hello.
I'm in trouble to import other indicator's value into an indicator.
If in example i want modify the RSI, having in it also the MA value,
i try to use iMA function, in example like this:
double MA;
MA=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,0);
or also like this
double bufmapre[];
bufmapre[i]=iMA(NULL,0,50,0,MODE_EMA,PRICE_MEDIAN,i-1);
or also
double MAI[];
MAI[i]=MA;
but it seems that the value of iMA is not imported, not in MA, neither in bufmapre[i], neither in MAi[i];
Why?
it is the correct syntax to import an indicator's value into another, with code example instruction i've written?
I should #include "Moving Averages.mq4" indicator in the begin of the RSI indicator to be modified?
If i include there is, obviously, a conflict of variables.
Can you help me?
It is strange i cannot import the iMA into the RSI indicator, as the Documentation write.
Thnx
I am not quite sure what you are trying to do regarding RSI values, but your first example will return a value.
double maValue = iMA(NULL,0,21,0,MODE_SMA,PRICE_CLOSE,0);
this will give you the value of a simple moving average for period of 21 for the current candle.
If you want to use an array, then you need to initialize the array with values first.
double maValues[]; for(int i=21; i>=0; i--) { maValues[i] = iMA(NULL,0,21,0,MODE_SMA,PRICE_CLOSE,i); }
Your array maValues will contain 22 values for the last 22 periods.
-Scott
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello.
I'm in trouble to import other indicator's value into an indicator.
If in example i want modify the RSI, having in it also the MA value,
i try to use iMA function, in example like this:
double MA;
MA=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,0);
or also like this
double bufmapre[];
bufmapre[i]=iMA(NULL,0,50,0,MODE_EMA,PRICE_MEDIAN,i-1);
or also
double MAI[];
MAI[i]=MA;
but it seems that the value of iMA is not imported, not in MA, neither in bufmapre[i], neither in MAi[i];
Why?
it is the correct syntax to import an indicator's value into another, with code example instruction i've written?
I should #include "Moving Averages.mq4" indicator in the begin of the RSI indicator to be modified?
If i include there is, obviously, a conflict of variables.
Can you help me?
It is strange i cannot import the iMA into the RSI indicator, as the Documentation write.
Thnx