Adv_buy_stop_script





//+------------------------------------------------------------------+
//| script "send pending buy stop order with expiration data"
//| Variable spacing function added   
//| Variable TP function added
//+------------------------------------------------------------------+
int start()
  {
   int    ticket,expiration;
   double point;
   // change the a value to set how many buy stop pending order
   int a = 20; 
   // change the b value to set your lot size
   double b = 0.01; 
   // change the c value to set how many hours from now until your pending expired
   double c = 240;
   // change the d value to set the spacing for the first position from the current ask price
   int d = 10;
   // you can change this e value with your expected price
   double e = Bid ; 
   // change the f value to set the spacing for the second position upward 
   int f = 19;
   // change the g value to set your take profit
   int g = 10;
 //----
   point=MarketInfo(Symbol(),MODE_POINT);
   expiration=CurTime()+PERIOD_D1*(c*2.5);
   for(int i=a;i>=0;i--)

//----
   while(true)
     {
      ticket=OrderSend(Symbol(),OP_BUYSTOP,b,e+(d*point),0,0,e+((d+g)*point),"some comment",16384,expiration,Green);
      d=d+f;
      if(ticket<=0) Print("Error = ",GetLastError());
      else { Print("ticket = ",ticket); break; }
      //---- 5 seconds wait
      Sleep(5000);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
It automatically opens orders when conditions are reached

Other Features: