Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Opening only an order per day

  1. #1

    Question Opening only an order per day

    Hi! I am sorry about so many questions, but if an EA is running on the 15TF and after it opens/closes the trade at the SL/TP even if the trade signal became true again, I don't want to let it opens a new trade at the same day, please could you let me know how I can do it? Thanks in advance for any help!

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by szmvscla View Post
    Hi! I am sorry about so many questions, but if an EA is running on the 15TF and after it opens/closes the trade at the SL/TP even if the trade signal became true again, I don't want to let it opens a new trade at the same day, please could you let me know how I can do it? Thanks in advance for any help!
    Hi szmvscla,

    In the extern parameters, add :

    Code:
    extern int MaxTradesPerDay=1;
    In the start function, add :

    Code:
    int orders=HistoryTotal();
    int DailyTrades;
    
    for(int i=orders-1;i>=0;i--){
       if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false){
          Print("Error in history!");break;
       }
       if(TimeDay(OrderCloseTime())!=TimeDay(TimeCurrent()))continue;
       if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && (OrderProfit()<0 || OrderProfit()>=0))DailyTrades++;
    }
    Before the ordersend function, add :

    Code:
    if(DailyTrades>=MaxTradesPerDay)return(0);

  3. #3

    Smile

    Quote Originally Posted by funyoo View Post
    Hi szmvscla,

    In the extern parameters, add :

    Code:
    extern int MaxTradesPerDay=1;
    In the start function, add :

    Code:
    int orders=HistoryTotal();
    int DailyTrades;
    
    for(int i=orders-1;i>=0;i--){
       if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false){
          Print("Error in history!");break;
       }
       if(TimeDay(OrderCloseTime())!=TimeDay(TimeCurrent()))continue;
       if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && (OrderProfit()<0 || OrderProfit()>=0))DailyTrades++;
    }
    Before the ordersend function, add :

    Code:
    if(DailyTrades>=MaxTradesPerDay)return(0);
    Thank you very much!

Similar Threads

  1. Replies: 2
    Last Post: 08-04-2014, 19:03
  2. EA controlling only bar opening
    By dr18 in forum Expert advisors backtesting
    Replies: 0
    Last Post: 03-12-2013, 17:07
  3. Open oppsite order if order don't take profit
    By luisneves in forum MQL programming
    Replies: 0
    Last Post: 12-06-2012, 17:09
  4. Opening 2 orders at the same time
    By szmvscla in forum MQL programming
    Replies: 5
    Last Post: 11-06-2009, 14:31

Tags for this Thread

signal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •