How to calculate an indicator from a previous?

 
Hi all,

i'm a newbie on MT4 and have a several monthes exp. on Forex. So here are my questions :

I want to code an indicator thats depends on another indicator and not on Close_price or median_price. When i apply a standard indicator on a chart i can choose if it's from close price, median or previous/first indicator. I just want to do the same but coded. How must i do?

Exemple :

Mobile Average put in ABuffer
ABuffer[i]=iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,i);

If i want a RSI calculated on my MA how can i write it?
Hope i'm clear....? Thanks for advance. ;)

iRSIOnArray(ABuffer,1000,14,0)

or iRSI(NULL,0,14,Abuffer,1))


 

iRSIOnArray(ABuffer,0,14,0)

 
phy:

iRSIOnArray(ABuffer,0,14,0)



Thanks Phy. :)
 
One more question :

If i want to apply my OnArray on the same value of my MA indexed to 0, should i leave :

OnArray(ABuffer,0,14,0)

or use previously :
ArraySetAsSeries(ABuffer,true); ?? (to reverse indexing)

And in my EA value of MA is returned in a double variable, not a buffer. Can i use it in RSIOnArray....????

I'm a little lost..... i think i must use ArraySEt but please confirm. :)

ANother question from the newbie coder i am.
After compilation i got a lot of "expression on globalscope not allowed".... what's the meaning of that? All my variable (int,double,bool) are defined on the global part of program, so...?

I'm debugging my bad code so i think i will have lots of questions soon.... :P
 

I too am confused by the use of ArraySetAsSeries, so I try both ways, true and false, until I get it correct for the situation.


"And in my EA value of MA is returned in a double variable, not a buffer. Can i use it in RSIOnArray....????"

Yes, but you have to put your values into an array first. It can be a small array, if using RSI 14, it needs at least 14 values of data.


After compilation i got a lot of "expression on globalscope not allowed"....

Compiler gets confused on errors involving mismatched () and {} sometimes... or it does for me... I'll keep it in mind for the
next time I see it here.

 
phy:

I too am confused by the use of ArraySetAsSeries, so I try both ways, true and false, until I get it correct for the situation.


"And in my EA value of MA is returned in a double variable, not a buffer. Can i use it in RSIOnArray....????"

Yes, but you have to put your values into an array first. It can be a small array, if using RSI 14, it needs at least 14 values of data.


After compilation i got a lot of "expression on globalscope not allowed"....

Compiler gets confused on errors involving mismatched () and {} sometimes... or it does for me... I'll keep it in mind for the
next time I see it here.

For ArraySet and RSI14 i thought i finally just need an Array with only one index RSIBuffer[0] because in an EA i only need the last value, and not the ones before to display as an indicator?
So it gives :
ABuffer = iMA (etc...)
ABuffer[0] = Abuffer;
IRSIonArray (Abuffer[0], 0,14,0). Am i right?? I wiil test that anyway.

For the expressions/globalscope i confirm : it comes when we put parenthesis instead of brackets. As a newbie in coding i didn't saw the difference on my screen until now. Problem solved. ;)

Many questions will come further when my Array calculatiions will be solved : especially on Ticket Orders and numbering.....

Phy thanks you again for your help. You are the golden one, ehehe. :) :)