In future please post in the correct section.
I will move this thread to the "MQL4 and MetaTrader4" section.
-
for(int i=0; i<40+1; i++) { RSIMinimumArray[i] = iRSI(_Symbol, _Period, 14, PRICE_CLOSE, i); lowestRSI = ArrayMinimum(RSIMinimumArray, 40, 1); if(lowestRSI < 30)
How do you think you can get a minimum before completely filling the array? - You are filling elements [0 … 40] Why are you searching [1 … 41]?
-
bool RSIBottom(){ ⋮ if(lowestRSI < 30){ RSIBottom(); } ⋮ return(RSIBottom());
Stack overflow means you are infinitely calling yourself.
I tweaked a bit and it looks like this works for me, although not elegant. Thanks for the ideas.
// initialization double RSIMinimumArray[100]; double lowestRSI; //body of the function bool RSIBottom() { for(int i=0; i<40; i++) { RSIMinimumArray[i] = iRSI(_Symbol, _Period, 14, PRICE_CLOSE, i); } lowestRSI = iRSI(_Symbol, _Period, 14, PRICE_CLOSE, ArrayMinimum(RSIMinimumArray, 40, 0)); if(lowestRSI < 30) return(true); return(false); }
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
Hello Forum,
I am writing a function in MQL4 where I want the lowest array of an RSI to be lower than a number I define. There is no error when I compile it but it won't execute. These are the errors I get from the Journal.
I have already deleted and redownloaded the prices from the price history, and also experimented with different numbers (level, e.g., 30).
Please let me know what's wrong with my code. Thanks.