Friday, June 29, 2018

Simple Buy Expert Advisor for MT4

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

//+------------------------------------------------------------------+
//|                                                                 openbuyorder.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 BUY
    OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Bid+TakeProfit*Point);
    return(0);                               
  }

}


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

Simple Sell Expert Advisor for MT4

No comments:

Post a Comment