//+------------------------------------------------------------------+
//|                                                  mn Drop BUY.mq4 |
//+------------------------------------------------------------------+
#property copyright "Mn"
#property show_inputs
#include <stdlib.mqh>

extern string xx = "*** WARNING You are about to BUY ***";
extern double mLots  = 1.0;
extern int mSlip     = 3;

//+------------------------------------------------------------------+
int start()
  {
   double mSL, mTP, mSpread = Ask - Bid;
   double mPrice = High[1] + mSpread;
   bool   result;
   int    mSlip, mError;
   
   int mPipFact;                                       
      if(Digits == 5 || Digits == 3)            
         mPipFact = 10;      
      else
         mPipFact = 1;            
   
   mSlip = mSlip * mPipFact; 
   mSL = Low[1];
   mTP = mPrice + (High[1] - Low[1]); 
   
   if(Ask < High[1])
     result = OrderSend(Symbol(), OP_BUYSTOP, mLots, mPrice, mSlip, mSL, mTP, "DropBuy", 0, 0, CLR_NONE);
 
   if(result != true) 
       { 
        mError = GetLastError(); 
        Comment("Error :  ", ErrorDescription(mError)); 
       }
   else mError = 0;

   return(0);
  }
//+------------------------------------------------------------------+