
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
calling iRSI does not lead to the indicator being recalculated, but simply returns the ready value
Until you call RefreshRates. Calling RefreshRates will lead to recalculation of the indicator, and the next iRSI call after RefreshRates may return a value different from the one it returned before RefreshRates.
And remember that my statement is only valid for the current symbol and the current timeframe.
Your code can be greatly simplified and made much more performant. In MT4 you don't need to create arrays and store rsi values in them. Just call iRSI every time you need its value - it will work much faster than your current code because calling iRSI does not lead to the indicator being recalculated, but simply returns the ready value.
In fact, the arrays are there because I expect to create an EA based on TDI and others indicators.
In principle, copying values into an array may be advisable if your other code expects an array of RSI values.
I will change the others function and use iRSI. I look at that tomorow and return to you with the result. Thank you.
Avoiding copying values into arrays won't solve your current problem.
I've already described why your code doesn't work as you expect:
https://www.mql5.com/en/forum/465710#comment_53078444
In principle, copying values into an array may be advisable if your other code expects an array of RSI values.
Avoiding copying values into arrays won't solve your current problem.
I've already described why your code doesn't work as you expect:
https://www.mql5.com/en/forum/465710#comment_53078444
Hello, I have tried to use the refreshrate without any success.
I have the following message in the journal when I test it on the strategy tester : 2024.04.19 16:23:33.129 2024.02.20 00:15:00 WAT EURUSD,M15: Failed to refresh rates at 2024.02.20 00:15:00 2024.04.19 16:23:33.223 2024.02.20 00:30:00 WAT EURUSD,M15: Failed to refresh rates at 2024.02.20 00:30:00 ... and so on.
Find also the preceding function used :
Note that I am new as a programmerLet's go in order. I highlighted the line from your original code that caused you to not update the RSI value on the current bar.
Forum on trading, automated trading systems and testing trading strategies
Wrong RSI on my EA project
navtrack1959, 2024.04.16 20:56
Following the OnTick. Assure declaring before datetime lastCandleTime = 0;