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