How to known if a candle is down (red) or up (green)

 

I need to get if the candle is green or red programatically. I already tried to use MqlRates and MarketBookGet to recover this info, but with no success.

Can you help me? 

 
barenko:

I need to get if the candle is green or red programatically. I already tried to use MqlRates and MarketBookGet to recover this info, but with no success.

Can you help me? 

You can compare the open price with close price :
  1. close price > open price means green candle
  2. close price < open price means red candle
 
barenko:

I need to get if the candle is green or red programatically. I already tried to use MqlRates and MarketBookGet to recover this info, but with no success.

Can you help me? 

Show what you have tried.
 
Sorry, I guess I misunderstood.

I understand that Red or green candle is determined as the Biantoro Kunarto commented and indicates the trades executed.

But what I need to determine is the volume of buyers and sellers in the order book at every tick.


I've tried using the official code example:


  MqlBookInfo priceArray [];
    Bool getBook = MarketBookGet (NULL, priceArray);
    If (getBook)
      {
       Int size = ArraySize (priceArray);
       Print ("MarketBookInfo for", Symbol ());
       For (int i = 0; i <size; i ++)
         {
          Print (i + ":", priceArray [i] .price
                + "Volume =" + priceArray [i] .volume,
                "Type =", priceArray [i] .type);
         }
      }
    Else
      {
       Print ("Could not get contents of the symbol DOM", Symbol ());
      }


But this code only returned "Could not get contents of the symbol DOM EURUSD".

 
barenko:
Sorry, I guess I misunderstood.

I understand that Red or green candle is determined as the Biantoro Kunarto commented and indicates the trades executed.

But what I need to determine is the volume of buyers and sellers in the order book at every tick.


I've tried using the official code example:


  MqlBookInfo priceArray [];
    Bool getBook = MarketBookGet (NULL, priceArray);
    If (getBook)
      {
       Int size = ArraySize (priceArray);
       Print ("MarketBookInfo for", Symbol ());
       For (int i = 0; i <size; i ++)
         {
          Print (i + ":", priceArray [i] .price
                + "Volume =" + priceArray [i] .volume,
                "Type =", priceArray [i] .type);
         }
      }
    Else
      {
       Print ("Could not get contents of the symbol DOM", Symbol ());
      }


But this code only returned "Could not get contents of the symbol DOM EURUSD".

Is the DOM available on your broker/symbol ? If yes, did you "enable" it ?
Reason: