Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1948
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Can you please tell me how to solve:
1) I have not loaded the history, in the chart window during the online process I had time to load 70 000 minute bars. I am loading my Expert Advisor in the Strategy Tester and just in case I have written the minimum number of bars for a certain pattern, it answered with "not enough bars for analysis". I print iBars and it says 1200 bars. I loaded history (8 000 000 bars). Restarted, settings show "9999999999" bars in window and history. Nova writes "not enough history". Print iBars, again 1200. what is this and how to solve it?
2) In the multicurrency analysis, how can I force the indicator not to miss new incoming ticks on other currency pairs, if the quotes are suddenly frozen on the current chart and OnTick does not call the check? I tried OnTimer but it does not work in the tester
And here is the result
It turns out that array b[] (which has reverse indexation) somehow duplicates its values after increasing the size
. Why? Am I missing something or have I made some mistake?
And this is the result
It turns out that array b[] (which has reverse indexing) has somehow duplicated values after increasing size
Why? Am I missing something or have I made some mistake?
In any case, we cannot rely on any values in the new array cells - these are uninitialised variables that can contain any rubbish.
And this is the result
It turns out that array b[] (which has reverse indexing) has somehow duplicated values after increasing the size
Why? Am I missing something or have I made some mistake?
You have to flip the array after it has been filled.
In any case we can't rely on any values in the new array cells - these are uninitialized variables that can contain any rubbish.
True, but there are 2 buts
1) Mirroring is observed at any other size and not only, as in my example - 5
2) If an array has reverse indexing, then new cells should appear at the beginning of the array - which is not the case
You have to flip the array after filling it.
I also thought of that - at least I don't see any other solution at the moment
2) If an array is reverse-indexed, then new cells should appear at the beginning of the array - which is not the case
Why should new cells appear at the beginning of an array? - If I'm not mistaken, it should be written in the help, that when you use ArraySetAsSeries(), the array will not be physically reallocated in memory, but reverse indexing will be applied when accessing array elements
SZZ: your example is complicated, I sketched it out:
2022.04.18 21:31:59.223 tst EURUSD,H1: arr2 = 5 , 4 , 3 , 2 , 1 , 0 , 0 , 0 , 0 , 0 ,
2022.04.18 21:31:59.223 tst EURUSD,H1: arr1 = 1 , 2 , 3 , 4 , 5 , 0 , 0 , 0 , 0 , 0 ,
2022.04.18 21:31:59.223 tst EURUSD,H1: Resize : 10 , 10
2022.04.18 21:31:59.223 tst EURUSD,H1: Start size : 5 , 5
I get'iClose' error - ambiguous call to overloaded function.
In general, the goal is to select the TF.
I wanted to choose it with MT4 out of habit
But I have failed.(
In general, the goal is to select the TF.
I wanted to choose it with MT4 out of habit
But I failed.
periods in MT5
if(Period()==1) return "M1";
if(Period()==2) return "M2";
if(Period()==3) return "M3";
if(Period()==4) return "M4";
if(Period()==5) return "M5";
if(Period()==6) return "M6";
if(Period()==10) return "M10";
if(Period()==12) return "M12";
if(Period()==15) return "M15";
if(Period()==20) return "M20";
if(Period()==30) return "M30";
if(Period()==16385) return "H1";
if(Period()==16386) return "H2";
if(Period()==16387) return "H3";
if(Period()==16388) return "H4";
if(Period()==16390) return "H6";
if(Period()==16392) return "H8";
if(Period()==16396) return "H12";
if(Period()==16408) return "Daily";
if(Period()==32769) return "Weekly";
if(Period()==49153) return "Monthly";
periods in mt5
if(Period()==1) return "M1";
if(Period()==2) return "M2";
if(Period()==3) return "M3";
if(Period()==4) return "M4";
if(Period()==5) return "M5";
if(Period()==6) return "M6";
if(Period()==10) return "M10";
if(Period()==12) return "M12";
if(Period()==15) return "M15";
if(Period()==20) return "M20";
if(Period()==30) return "M30";
if(Period()==16385) return "H1";
if(Period()==16386) return "H2";
if(Period()==16387) return "H3";
if(Period()==16388) return "H4";
if(Period()==16390) return "H6";
if(Period()==16392) return "H8";
if(Period()==16396) return "H12";
if(Period()==16408) return "Daily";
if(Period()==32769) return "Weekly";
if(Period()==49153) return "Monthly";
Thank you!