Where do you place your code?
If you place it in OnInit, the Close array will not be loaded, so it will return 0.
This is within the OnTick function.
I was just using the Close array as an example.
Originally I read some data from a file into an array that I created and tried to calculate the iRSIOnArray on it, but it returned 0. So I started to think maybe it is something wrong with the array that I have created. So instead I test it on one of the predefined arrays that I know must be correct but still I get 0.
Do you really want the RSI for the last 20,000 bars? That will be a flat line.
I was under the impression that it means it will take the whole array, but only calculate RSI on the last 10 bars.
Either way there is something wrong with the code or function as the answer returns 0 whether I use:
double RSI = iRSIOnArray(Close,0,10,0);
or:
double RSI = iRSIOnArray(Close,10,10,0);
So I'm not sure what is going wrong...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
Could someone help me with how to use the iRSIOnArray function.
For example, why does this not work?
I'm just playing around with it to try and understand how it works. When I run this it returns zero. I assumed the Close array would be fine to test it with and a basic 10 period.
My goal is to read in some data from a text file and calculate RSI on the values, but obviously need to get it working on live chart values first.
Thanks.