//+------------------------------------------------------------------+
//|   MySell.mq4
//+------------------------------------------------------------------+
#include <stdlib.mqh>
#include <WinUser32.mqh>

extern double Lots = 0.5;
extern double StopLoss = 20;
extern double TakeProfit = 0;

double SL,TP,Spread;

int start()
{
   RefreshRates();

   SL = NormalizeDouble(Bid+(StopLoss*Point),Digits);
   if (TakeProfit > 0)
   {TP = NormalizeDouble(Bid-(TakeProfit*Point),Digits);}
   else
   {TP = 0;}

   int ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,0,SL,TP);

   if(ticket<1)
   {
      int error=GetLastError();
      Comment("\nError = ",ErrorDescription(error));
      return;
   }
   else
   {Comment(" ");}

   return(0);

}
//+------------------------------------------------------------------+