previous bar OHLC -
1 2 3

thread: previous bar OHLC

  1. #21
    Junior Member Pelirrojaaa13's Avatar
    17
    it's possible to compare worth Open Price for new candle with worth Close Price for previous candle? If possible, how to code?

    Let say:

    if(Open[1]_New_Candle gt; Close[1]_Previous_Candle)
    print Great

    vice verse

    TQ
    Yes it is quite straightforward, you need to read the http://book.mql4.com/

    Inserted Code if( Open#91;0#93; gt; Close#91;1#93;-RRB- Printing ( Good ); else if( Open#91;0#93; lt; Close#91;1#93;-RRB- Printing (Poor );
    comparing double values could be a small minefield though, it is feasible to get an evaluation of price == price to return false... read this for more info: http://forum.mql4.com/45053

  2. #22
    Junior Member sadsuky's Avatar
    26
    Yes it is quite straightforward, you should read the http://book.mql4.com/

    Inserted Code if( Open#91;0#93; gt; Close#91;1#93;-RRB- Printing ( Great ); yet if( Open#91;0#93; lt; Close#91;1#93;-RRB- Printing (Poor ); contrasting double values can be a small minefield though, it's possible to get a test of price == price to yield false... read this to get more information: http://forum.mql4.com/45053
    TQ for awesome reply. I have issue. I am try to open article together with this condition. But my EA open article. My idea is available one article for every new candle which match my condition. could u fix my code?

    Double start()

    if( Open[0] gt; Close[1])
    //Opinion (Buy);
    int ticketB = -1;
    dual BuySL = Ask - BuyStoploss*PipValue*Stage;
    if (BuyStoploss == 0) BuySL = 0;
    dual BuyTP = Ask BuyTakeProfit*PipValue*Stage;
    if (BuyTakeProfit == 0) BuyTP = 0;
    ticketB = OrderSend(Symbol(), OP_BUY, BuyLots, Ask, 4, BuySL, BuyTP, Buy SE, 1, 0, Blue);
    else if( Open[0] lt; Close[1])
    //Opinion (Sell);
    int ticketS = -1;
    dual SellSL = Ask - SellStoploss*PipValue*Stage;
    if (SellStoploss == 0) SellSL = 0;
    dual SellTP = Ask SellTakeProfit*PipValue*Stage;
    if (SellTakeProfit == 0) SellTP = 0;
    ticketS = OrderSend(Symbol(), OP_SELL, SellLots, Bid, 4, SellSL, SellTP, Quotation SE, 1, 0, Red);
    else
    Comment (No Post Open);
    //--

    return(0);

  3. #23
    Senior Member okeinamixxiok's Avatar
    103
    Indior

    Draws two labels: Open-Close and High-Low range of the last closed candle left of the current candle.Open: 1.26137 - Close: 1.26129 #8594; OC 8 High: 1.26263 - Low: 1.26050 #8594; HL 213 https://c.mql5.com/18/31/OHLC_Range.PNG
    https://www.cliqforex.com/attachment...1282922725.mq4

  4. #24
    This one is easy. It will be a piece of code like:

    Inserted Code Comment(Open#91;1#93;,High#91;1#93;,Reduced #91;1#93;,Close#91;1#93;-RRB-;
    plus it would display right under the current OHLC

  •