Download MetaTrader 5
To add comments, please log in or register
You can test an application before buying it. Find out how to do that!
Opengates
165
Opengates 2015.11.16 01:59 

Hello Everybody,

Please I need your help. I made this ea to pick trades on news release but when the time set is reached it doesn't pick trades.

Take a look at the code below maybe there is something I am doing wrong: Thanks in advance

extern string        newsdate         = "2015.06.10"; // Date for the News to be released
extern string        newstime         = "14:00";   // Time for the News to be released

datetime Cur_time=TimeCurrent();
string   timedate=StringConcatenate(newsdate," ",newstime);
datetime Starttime=StrToTime(timedate); 

 if(Cur_time>=Starttime && clear_to_send) { 
    RefreshRates();
    Ticket=OrderSend(Symbol(),OP_BUYSTOP,lot,Ask+iDstc*Point,0,Bid-(stp_ls*Point+iDstc*Point),Bid+(iTp1*Point+iDstc*Point));     
    Ticket=OrderSend(Symbol(),OP_BUYSTOP,lot,Ask+iDstc*Point,0,Bid-(stp_ls*Point+iDstc*Point),Bid+(iTp2*Point+iDstc*Point));    
    Ticket=OrderSend(Symbol(),OP_SELLSTOP,lot,Bid-iDstc*Point,0,Ask+(stp_ls*Point+iDstc*Point),Ask-(iTp1*Point+iDstc*Point));        
    Ticket=OrderSend(Symbol(),OP_SELLSTOP,lot,Bid-iDstc*Point,0,Ask+(stp_ls*Point+iDstc*Point),Ask-(iTp2*Point+iDstc*Point));      
    clear_to_send=false;   }    
Keith Watford
Moderator
7979
Keith Watford 2015.11.16 02:38  

Check if an OrderSend fails and print the error

Where is clear_to_send set to true? 

Why are you calculating Stoploss and Take profits on Bid and Ask? They should be calculated from the entry price. 

/
To add comments, please log in or register