avatar
Vu Khương

Guest 528 5th May, 2020

CSHARP 1.75 KB
                                           
                         datetime last;
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnTick()
 
{ if(last != Time[0]) { XoaLenhCu("Khuongd1UJ"); 
OrderSend( 
Symbol(),
 OP_BUYSTOP,
 Lot1,
 iHigh(Symbol(), PERIOD_D1, 1), 0,
 iHigh(Symbol(), PERIOD_D1, 1) - 0.05,
 iHigh(Symbol(), PERIOD_D1, 1) + 0.05, 
"Khuongd1UJ" ); 
OrderSend( Symbol(),
 OP_BUYSTOP,
 Lot2, 
 iHigh(Symbol(), PERIOD_D1, 1), 0, 
 iHigh(Symbol(), PERIOD_D1, 1) - 0.05,
 iHigh(Symbol(), PERIOD_D1, 1) + 0.10,
  "Khuongd1UJ" );
 OrderSend( Symbol(),
 OP_BUYSTOP,
 Lot3,
 iHigh(Symbol(), PERIOD_D1, 1), 0,
 iHigh(Symbol(), PERIOD_D1, 1) - 0.05, 
 iHigh(Symbol(), PERIOD_D1, 1) + 0.15, 
"Khuongd1UJ" );
 OrderSend( Symbol(), 
OP_SELLSTOP, 
Lot1,
 iLow(Symbol(), PERIOD_D1, 1), 0,
 iLow(Symbol(), PERIOD_D1, 1) + 0.05,
 iLow(Symbol(), PERIOD_D1, 1) - 0.05,
 "Khuongd1UJ" );
 OrderSend( Symbol(),
 OP_SELLSTOP,
 Lot2, 
 iLow(Symbol(), PERIOD_D1, 1),0,
 iLow(Symbol(), PERIOD_D1, 1) + 0.05, 
 iLow(Symbol(), PERIOD_D1, 1) - 0.10,
 "Khuongd1UJ" );
 OrderSend( Symbol(),
 OP_SELLSTOP, 
Lot3, 
 iLow(Symbol(),PERIOD_D1, 1), 0, 
 iLow(Symbol(), PERIOD_D1, 1) + 0.05, 
 iLow(Symbol(), PERIOD_D1, 1) - 0.15,
 "Khuongd1UJ" );
 last = Time[0]; } }
 void XoaLenhCu(string comment){ 
for(int i = OrdersTotal()-1; i>=0; i--){
 if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
 if(OrderComment() == comment){ OrderDelete(OrderTicket(), Red); } } }
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data

Comments

Authentication required

You must log in to post a comment.

Log in
    There are no comments yet.