Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 534

 
PolarSeaman:

Maybe so:

Where is the previous day's condition here? It turns out that after the first order in the 0-8 period, the step will already be 10. And we need it to be 5. And only after 8 o'clock it will become 10. Then we return step =5 to 0 if there are no open orders from the previous day. If the series continues, then step =10 before its close.
 
PolarSeaman:

The point is that if you set the time interval as in the Expert Advisor

I need to exclude the candlesticks that are in the interval from the calculations.

In the indicator you work in a loop. So why do you need to exit the loop?

Don't you know how to skip an iteration in the loop?

continue

 
Tigerfreerun:
Where is the condition for the previous day? It turns out that after the first order in the 0-8 period, the step will already be 10. And we need that it was 5. And only after 8 o'clock it will become 10. Then we return step =5 to 0 if there are no open orders from the previous day. If the series continues, then step =10 before its close.

The function should return тру, if there is an order opened yesterday

   OP_TO(int mn)
     {
     int i, k=OrdersTotal();
      for(i=0; i<k; i++) 
        {
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) 
           {
            if(OrderSymbol()==Symbol()) 
              {
               if(OrderType()==OP_BUY || OrderType()==OP_SELL) 
                 {
                  if(OrderMagicNumber()==mn) 
                    {
                     if(TimeDay(OrderOpenTime())==(Day()-1)
                      &&  TimeMonth(OrderOpenTime())==Month()
                      &&  TimeYear (OrderOpenTime())==Year()) return(True);
                    }
                 }
              }
           }
        }

      return(False);
     }
if(Hour()>=0&&Hour()<=8&&!OP_TO(mag_n))step = 5; else step =10;
 
Artyom Trishkin:

In the indicator you are working in a loop. So why do you need to exit the loop with return?

Do you know how to skip an iteration in a loop?

continue

Thank you. I don't get it, I limited the time but the print shows the time at 19:30 and 23:00 and 5:50, what's wrong?

   for(int i=limit-2; i>0; i--) 
     {
     if(Hour()>=17&&Hour()<=11)continue;
      if(i%2==0) 
        {
         if(open[i]<close[i] && open[i+1]>close[i+1]) 
           {
            k1++;
           // if(k1>max) {max=k1; dat_max=time[i];}
            if(k1>=4)Print("Num: ",k1,"dat_max ",time[i]);
            SetText("Obj_"+(string)time[i],(string)k1,time[i],high[i],Arr);
           }
         else k1=0;
         
           } else {
         if(open[i]<close[i] && open[i+1]>close[i+1]) 
           {
            k2++;
            //if(k2>max){ max=k2; dat_max=time[i];}
            if(k2>=4)Print("Num: ",k2,"dat_max ",time[i]);
            SetText("Obj_"+(string)time[i],(string)k2,time[i],high[i],Arr);
           }
         else k2=0;
         
        }
      
     }
 
PolarSeaman:

Thank you. I don't understand, the print shows the time as 19:30 and 23:00 and 5:50 what's wrong?

What does the Hour() function return?
 
PolarSeaman:

The function should return тру, if there is an order opened yesterday

It's a bit complicated for me. Could you explain in which part of the code to add and what does it mean mn and mag_n? where should I put my EA medjic here?




 
Gentlemen programmers, help me to understand the error. minPrice = NormalizeDouble (GetMinPrice(),Digits); Error: 'minPrice' - semicolon expected.
 
KRIKS:
Gentlemen, please help me to understand the error. minPrice = NormalizeDouble (GetMinPrice(),Digits); Error: 'minPrice' - semicolon expected.

Look at the code before minPrice. There is no ; (semicolon) there.

 
Ihor Herasko:

Look at the code before minPrice. There is no ; (semicolon) there.

int start()

{

minPrice = NormalizeDouble (GetMinPrice()Digits);

maxPrice = NormalizeDouble(GetMaxPrice()Digits); Can int start be followed by (;) ?

 
KRIKS:

int start()

{

minPrice = NormalizeDouble(GetMinPrice()Digits);

maxPrice = NormalizeDouble(GetMaxPrice()Digits); Can int start be followed by (;) ?

{

minPrice = NormalizeDouble (GetMinPrice(),Digits);

maxPrice = NormalizeDouble(GetMaxPrice(),Digits);

Reason: