Questions from Beginners MQL4 MT4 MetaTrader 4 - page 74

 
MikeZv:

What does swap have to do with testing ?
Profit what do you consider?
 

Hello, Can you please tell me if it is possible to write a function that matches the time of the terminal and the computer (my time zone), so that in the parameters of the EA I just entered the desired time in my time zone, if so, tell me how, what predefined functions to use for this. Thanks in advance!

 
Arseniy Barudkin:

Hello, Can you please tell me if it is possible to write a function that matches the time of the terminal and computer (my time zone), so that in the parameters of the EA I just entered the desired time in my time zone, if so, tell me how, what predefined functions to use for this. Thanks in advance!

Here's everything related to time
 
hello, can you give me an example of a simple function for calculating a series of losing/profitable orders???
 
Dmitry Melnichenko:
Hi, can you give me an example of a simple function for calculating a series of losing/profitable orders?

series, I mean, continuous, I guess?
 

Didn't check(

void SER()
  {
   int loss=0;
   int win=0;
   for(int pos=OrdersHistoryTotal()-1;pos>=0;pos--)
     {
      if(!OrderSelect(pos,SELECT_BY_POS,MODE_HISTORY)){break;}
      if(OrderProfit()>0 && loss>0){break;}else{win++;continue;}
      if(OrderProfit()<0 && win>0){break;}else{loss++;continue;}
     }
  }
 
Nikolay Gaylis:

Didn't check(


Thanks, I'll give it a try!
 
Dmitry Melnichenko:

Thanks for trying!

continue;
 

If a series has a profit of an order equal to zero - ignore it and keep counting...(just in case)

void SER()
  {
   int loss=0;
   int win=0;
   for(int pos=OrdersHistoryTotal()-1;pos>=0;pos--)
     {
      if(!OrderSelect(pos,SELECT_BY_POS,MODE_HISTORY)){break;}
      if(OrderProfit()==0){continue;}
      if(OrderProfit()>0 && loss>0){break;}else{win++;continue;}
      if(OrderProfit()<0 && win>0){break;}else{loss++;continue;}
     }
  }
 
Nikolay Gaylis:

If a series has a profit of an order equal to zero - ignore it and keep counting...(just in case)

And if the profit is +1, and the swaps and commissions are -5, then it is still profitable?