I try to write an array and work against it, thie what I wrote :
int arr[10] = { 1, 5, 15, 30, 60, 120, 240, 1440, 10080, 43200 }; Alert("ArraySize(arr[10]) : " + ArraySize(arr[10]));// Alert: ArraySize(arr[10]) : -1 int thisPeriod = Period(); int time_1,time_2,time_3,y; for( y=0 ; y <ArraySize(arr[9]) ; y++) { if(thisPeriod==arr[y]) { time_1=arr[y+1]; time_2=arr[y+2]; time_3=arr[y+3]; } Alert(time_1+" ; "+time_2+" ; "+time_3+" "+thisPeriod+" "+arr[10]); }
but as you can see the return value for the array size came -1,
any Help will be very appreciated .
int arr[10] = { 1, 5, 15, 30, 60, 120, 240, 1440, 10080, 43200 }; Alert("ArraySize(arr[10]) : " + ArraySize(arr));// Alert: ArraySize(arr[10]) : -1 int thisPeriod = Period(); int time_1,time_2,time_3,y; for( y=0 ; y <ArraySize(arr) ; y++) { if(thisPeriod==arr[y]) { time_1=arr[y+1]; time_2=arr[y+2]; time_3=arr[y+3]; } } Alert(time_1+ " ; " + time_2+ " ; " + time_3 + " " + thisPeriod + " " + arr[10]);
ho, BTW arr[10] = 0, because it's starting by arr[0], arr[1], arr[2] ..... arr[9]
Thank you gjol. thes was the problem ArraySize(arr)
me
![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
Hi Everyone,
I need to check an indicator on the next 3 time frame according to the time frame my curt is,
lets say I'm on 5 minutes time frame curt so I need to check let say "parabolic sar" on 15 / 30 / 1H time frames,
to get "this" curt time frame I will use Period() but how can I get the next 3 time frames ?
any Idea?
Thank you in advance,
me.