In such cases:
- look in the logs, Expert & Journal!!
- Learn tu use the debugger:
https://www.metatrader5.com/en/metaeditor/help/development/debug // Code debugging
https://www.mql5.com/en/articles/2041 // Error Handling and Logging in MQL5
https://www.mql5.com/en/articles/272 // Tracing, Debugging and Structural Analysis of Source Code
https://www.mql5.com/en/articles/35 // scrol down to: "Launching and Debuggin"
Code debugging - Developing programs - MetaEditor Help
- www.metatrader5.com
MetaEditor has a built-in debugger allowing you to check a program execution step by step (by individual functions). Place breakpoints in the code...
-
if(iRSI(NULL, PERIOD_CURRENT, rsi, PRICE_CLOSE, rsi_shift+i) > 20 ⋮ Buffer1[i] = High[i] + …
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon. -
if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
This broken code only allows a maximum look back of 50. See How to do your lookbacks correctly #9 — #14 & #19.
-
Your look back is eight (rsi). If your first run has insufficient bars, you return rates_total instead of prev_calculated.
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
guys..... read this calmand tell me what to do
I have created buy sell custom indicator using RSI indicator by shifting -3.
(yes I know, RSI hasn’t settings to shift in default)
My Indicator look back 5000 bars from current bar to show the signals( buy or sell arrow) history. And omits the oldest 50 bars to keep away from “Array out of range” error and keep running on chart.
When I load this indicator for the first time to the chart (at any moment), or refreshing chart window/indicator after few minutes (example – 40 minitues) from first loading time, indicator shows buy or sell signals from current bar to 5000 bars backward.
But the problem is,
If I don’t refresh the chart window/indicator after the first loaded time or from last refreshed time, Indicator shows nothing even if time passes for months.
Its only shows the history from first loaded time or last refreshed time. If I want to use indicator, I has to be refreshing it all the time.
guys As you think, what would be the reason for this ?
can you tell me the code I should use to solved this ?
I attached the code-script in bellow,