Writing an EA to execute market order with SL and TP at specific time

 

I would like to ask how do you write an EA that execute market order regardless of the price with SL and TP at specific time everyday?

Eg, execute market order with fixed TP and SL for USD/JPY and time 8pm everyday. 

 
Jonah Sim:

I would like to ask how do you write an EA that execute market order regardless of the price with SL and TP at specific time everyday?

Eg, execute market order with fixed TP and SL for USD/JPY and time 8pm everyday. 


There's a zillion ways to do it but this may get you thinking down the right path


   if (Hour()>=StartHour && OrderTicketNumber<=0)
   {
      OrderTicketNumber=OrderSend(mySymbol,TradeDirection,LotSize,Price,Slippage,SL,TP,myComment,MagicNum,0,ArrowColor);
      NoMoreTradesToday=true;
   } 
Reason: