Friday, June 29, 2018

Simple Sell Expert Advisor for MT4

For simple place sell order on MT4 using expert advisor code:
This code place one sell order automatically on your MT4 window.

//+------------------------------------------------------------------+
//|                                                                 opensellorder.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.forexwithcandlestick.blogspot.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.forexwithcandlestick.blogspot.com"
#property version   "1.00"
#property strict
//+----------------------------------------------------------------------
extern double Lots =0.1;
extern double StopLoss=50;
extern double TakeProfit=50;
extern int Slippage=3;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int start(){

//manage open orders here

if (OrdersTotal() > 0){
      return(0);
}

//open new orders here
{                                          // Opening SELL
    OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask-StopLoss*Point,Ask+TakeProfit*Point);
    return(0);                                 
  }

}


//----------------------------------------------------------------------------+


No comments:

Post a Comment