how to code Buy/Sell Limit/Stop order with close high low candle ea strategy

 

Hi All Senior , I am very new into Mql4 code . Would like to seek for advise about coding ,  Appreciate anyone can advise and teach ...... Thank you and sorry if the code is messy 

i wanted create an EA that following

entry : Buy Stop order at last 3 candle high above 300 point ( include wick)

entry : Sell Stop order at last 3 candle low below 300 point ( include wick )

once entry one buy/sell opposite pending cancel 

if buy > sell limit order will place following last 2 candle lowest 300 point ( include wick ) 

if sell > buy limit order will place following last 2 candle highest 300 point ( include wick )

sell/buy limit order will reset and move follow new 2 candle highest/lowest, once candle touch limit order opposite active order will close


my example:

struct candlesticks 

  { 

   double            open;  // open price 

   double            close; // close price 

   double            high;  // high price 

   double            low;   // low price 

   datetime          date;  // date 

  }; 



void OnTick()

  {

   // if no open orders exist

   if (OrdersTotal()==0)

   

   // send a sell limit order

   int buyticket = OrderSend



  int Mode = OP_BUYSTOP;

  double Entry=NormalizeDouble((Open[3]),MODE_DIGITS);

  if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT; 

  if (Entry == 0)  {Entry = Ask; Mode = OP_BUY;

}



void OnTick()

  {

   // if no open orders exist

   if (OrdersTotal()==0)

   

   // send a sell limit order

   int sellticket = OrderSend



  int Mode = OP_SELLSTOP;

  double Entry=NormalizeDouble((Open[3]),MODE_DIGITS);

  if (Bid > Entry && Entry > 0) Mode = OP_SELLLIMIT; 

  if (Entry == 0)  {Entry = Bid; Mode = OP_SELL;

}



int Mode = Close

double Close=.................................................................................. 
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Price Constants - Indicator Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
          General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
          Messages Editor