how to creat code Send only 1 Order in 1 day or 00.00-24.00

 


i need Send only 1 order

code


int OrderInOneDay(int type)

{
   int Cnt=0;
      int  totalHistory;
         for (int i = OrdersHistoryTotal()-1; i >=0; i--) 
         {
            totalHistory=OrderSelect( i, SELECT_BY_POS, MODE_HISTORY );
            if (OrderSymbol() == Symbol() && OrderMagicNumber()==MagicNumber ) 
            {
               if(TimeDay(TimeCurrent())!= TimeDay(OrderOpenTime())) Cnt++;
            }
          }
      return(Cnt);
}
 

https://www.mql5.com/en/forum/140650

one trade per day...
one trade per day...
  • 2012.08.01
  • www.mql5.com
Hello I want to know CODE about one trade per day...
 
Boripath Boonrit: i need Send only 1 order
  1. When you post code please use the SRC button! Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. if(TimeDay(TimeCurrent())!= TimeDay(OrderOpenTime())) Cnt++;
    What you are counting is the total closed orders not opened today. Don't you want to know the number of orders opened today?
  3. I also assume you are also checking if an order is currently open.

  4. int  totalHistory;
    :
       totalHistory=OrderSelect( i, SELECT_BY_POS, MODE_HISTORY );
    Select doesn't return an int. Check your return codes for errors and report them.
              What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles

  5. TimeDay Returns the day of month of the specified date Date and Time
    After one month, you will be seeing month old trades as todays trades. Use date:
              Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum

Reason: