Download MetaTrader 5
To add comments, please log in or register
Do you want to learn MQL5? 300 articles will help you!
Mohammad Ali
18118
Mohammad Ali 2014.02.18 08:35 

Dear Guys,

Below code not work with new build. but it work on old MQL. in Alert Indi1DayMoArray[1] show nothing. but it should be show "08:00:59"

string Indi3_Day_Mo   = "04:30:59;08:00:59;16:23:59";
string Indi1DayMoArray[20];

void MakeAllTime(string LotsProgression, string &TimeSet[]){
   int i,j,k;
   string ls;
   //ArrayInitialize(TimeSet,100);
   while (true) {
        j=StringFind(LotsProgression,";",i);
        if (j>0) {
                ls=StringSubstr(LotsProgression,i,j-i);
                i=j+1;
                k++;
                ArrayResize(TimeSet,k);
                Alert(ls);
                TimeSet[k-1]=ls;
        } else {
                ls=StringSubstr(LotsProgression,i);
                k++;
                ArrayResize(TimeSet,k);
                TimeSet[k-1]=ls;
                break;
        }
   }
}

void OnTick() 
{
   MakeAllTime(Indi3_Day_Mo,Indi1DayMoArray);
   Alert(Indi1DayMoArray[1]);
}
qjol
3243
qjol 2014.02.18 08:46  

there isn't OnTick in the old MT4

void OnStart() 

instead of

void OnTick() 

working just fine (i used a script)

Alain Verleyen
Moderator
28658
Alain Verleyen 2014.02.18 10:30  
capilta:

Dear Guys,

Below code not work with new build. but it work on old MQL. in Alert Indi1DayMoArray[1] show nothing. but it should be show "08:00:59"

08:00:59 is shown. Code as provided, build 610.

2014.02.18 11:28:52.473 _testing_ EURUSD,M1: Alert: 08:00:59

I suggest you to initialize all your variables (mainly i and k aren't initialized in your code), see documentation :

Any variable can be initialized during definition. If a variable is not initialized explicitly, the value stored in this variable can be any. Implicit initialization is not used.
/
To add comments, please log in or register