Results 1 to 2 of 2
 0 Attachment(s)    

Thread: Targeting candles and pips

  1. #1
    Junior Member
    Join Date
    Sep 2015
    Location
    UK
    Posts
    2

    Question Targeting candles and pips

    Hello programmers,
    How do I achieve the following:
    • If current candle is above SMA by 10 pips then BUY
    • If current candle is below SMA by 10 pips then SELL


    This is what I currently have and it's not working , help would be greatly appreciated. Thanks!

    Code:
    //+------------------------------+
    //|  OPEN BUY ORDER              |
    //+------------------------------+
       if (High[0] > sma && Point >= 10) {
          ticket = OrderSend(Symbol(), OP_BUY, Lots, ND(Ask), 0, 0, 0, "(FTM) BUY Order Opened", Magic_Instance); 
       }
          
    //+------------------------------+
    //|  OPEN SELL ORDER             |
    //+------------------------------+
       else if(Low[0] < sma && Point >= 10) {
          ticket = OrderSend(Symbol(), OP_SELL, Lots, ND(Bid), 0, 0, 0, "(FTM) SELL Order Opened", Magic_Instance); 
       }
    Last edited by sysvar; 09-11-2015 at 10:17.

  2. #2
    Junior Member
    Join Date
    Sep 2015
    Location
    UK
    Posts
    2

    Default

    Never mind, found solution:

    Code:
    //+------------------------------+
    //|  OPEN BUY ORDER              |
    //+------------------------------+
       if (High[0] - SMA >= 10.0 * Point) {
          ticket = OrderSend(Symbol(), OP_BUY, Lots, ND(Ask), 0, 0, 0, "(FTM) BUY Order Opened", Magic_Instance); 
       }
          
    //+------------------------------+
    //|  OPEN SELL ORDER             |
    //+------------------------------+
       else if(sma - Low[0] >= 10.0 * Point) {
          ticket = OrderSend(Symbol(), OP_SELL, Lots, ND(Bid), 0, 0, 0, "(FTM) SELL Order Opened", Magic_Instance); 
       }

Similar Threads

  1. RSI X Candles EA
    By funyoo in forum Expert advisors backtesting
    Replies: 0
    Last Post: 03-09-2011, 15:18
  2. Randy Candles
    By dryclean in forum Ideas for expert advisors
    Replies: 10
    Last Post: 01-04-2009, 07:10

Tags for this Thread

candle, candles, high, magic, mql4, pips, programming, sma

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •