limit EA Number of Trades Per day

 

hello guys

I have developed an EA which i want to take a maximum of three trades per day. but it seems my function for that is not working. still learning, your help would be much appreciated. my code below

      int TodaysOrders = 0;

      for(int i= OrdersTotal()-1; i >=0; i--)
        {

         OrderSelect(i, SELECT_BY_POS,MODE_TRADES);

         if(TimeDayOfYear(OrderOpenTime()) == TimeDayOfYear(TimeCurrent()))
           {

            TodaysOrders += 1;

           }
 
  1. This is the MT5 forum. Orders are only pending trades. Open trades are positions (via CPositionInfo or directly).
  2. Your test is for concurrently open, not total per day.
 
William Roeder #:
  1. This is the MT5 forum. Orders are only pending trades. Open trades are positions (via CPositionInfo or directly.).
  2. Your test is for concurrently open, not totally.
Please how should I do it. Use history?. Help me here please
 
Philip Ninson #: Please how should I do it.
  1. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. What is “it.”
  2. Confirm that you are using MT5.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem
 
William Roeder #:
  1. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. What is “it.”
  2. Confirm that you are using MT5.
I'm using mt4
 
Philip Ninson #:
I'm using mt4
The thing is when I open the link to mql4 forum it brings me here. Why?
 
Philip Ninson #: The thing is when I open the link to mql4 forum it brings me here. Why?

Because this is the MT4 sub-forum. Your post was moved here.

 
William Roeder #:

Because this is the MT4 sub-forum. Your post was moved here.

Ok
 
William Roeder #:

Because this is the MT4 sub-forum. Your post was moved here.

Please any help with my issue?
Reason: