Download MetaTrader 5
To add comments, please log in or register
Find out how social trading can improve your profits
flwilliams87
207
flwilliams87 2015.06.19 18:00 
Been trying to capture RSI value (which should be between 0 and 100) but iRSI does seem to provide that.  Am I missing something?
Marco vd Heijden
Moderator
4044
Marco vd Heijden 2015.06.19 18:50  
wheres the code
flwilliams87
207
flwilliams87 2015.06.19 19:25  
Marco vd Heijden:
wheres the code

Code is below and I am struggling with how to capture the value of RSI so I can build an array...


input int RSIperiod=14; // Period for calculating the RSI. At least that's what the book says

RSIHandle=iRSI(NULL,0,RSIperiod,PRICE_CLOSE);


   CopyBuffer(RSIHandle, "What wold go here?",0,17,RSI_ARRAY);
   ArraySetAsSeries(RSI_ARRAY,true);

Marco vd Heijden
Moderator
4044
Marco vd Heijden 2015.06.19 20:08  
 int       buffer_num,           // indicator buffer number
flwilliams87
207
flwilliams87 2015.06.19 20:31  

Okkk?  So I would do something like....


RSIHandle=iRSI(NULL,0,RSIperiod,PRICE_CLOSE);

int buffer_num;

buffer_num=RSIHandle;

CopyBuffer(RSIHandle,buffer_num,0,17,RSI_ARRAY);

ArraySetAsSeries(RSI_ARRAY,true);

Marco vd Heijden
Moderator
4044
Marco vd Heijden 2015.06.19 20:32  

try 0

i assume you only have one buffer....

flwilliams87
207
flwilliams87 2015.06.19 20:48  
Marco vd Heijden:

try 0

i assume you only have one buffer....

I have multiple buffers. one for MACD, one for EMA, and one for RSI. I'm attempting to do comparisons on the three arrays copied into these buffers depending on the value of SMA.  But I'm not quire sure what you mean by try '0'.
Alain Verleyen
Moderator
28536
Alain Verleyen 2015.06.19 20:58  
flwilliams87:
I have multiple buffers. one for MACD, one for EMA, and one for RSI. I'm attempting to do comparisons on the three arrays copied into these buffers depending on the value of SMA.  But I'm not quire sure what you mean by try '0'.

RSI has only 1 buffer, the buffer index always start at 0. So you have to use 0 as second parameter for CopyBuffer.

For EMA, there is always 1 buffer only, so it will be 0 too.

MACD has 2 buffers, main is 0 and signal is 1.

Etc...please read the documentation.

/
To add comments, please log in or register