Identifying the Candle

 

I'm trying to identify candles where, a buy candle has more selling than buying, and a sell candle has more buying than selling. I have the values , but drawing the arrows to mark the candle is a bit of a problem. The following code is suppose to draw a green down arrow, on the high ,of a sell candle, when there's more increases in the close price, than decreases; a white down candle when there's more decreases in the close price, than increases; and a yellow when there is only decreases.

For a buy candle, a red down arrow, when there's more decreases in the close price, than increases; a white down candle when there's more increases than decreases; and a yellow when there is only increases.

The code instead, is drawing a red up candle for each condition. I realize that there can be more than one arrow drawn on a candle due to changes in conditions. That's o.k. for now, I can deal with that later. Just trying to get the right candle to be drawn first. Not sure what I'm doing wrong.

Thanks!

if( vO > vC && dB < dS && dB != 0 )

{

ObjectCreate("UpASymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("UpASymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("UpASymbl", OBJPROP_COLOR, White);

}

if( vO > vC && dB > dS && dS != 0 )

{

ObjectCreate("UpBSymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("UpBSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("UpBSymbl", OBJPROP_COLOR, Lime);

}

if( vO > vC && dB == 0 )

{

ObjectCreate("UpCSymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("UpCSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("UpCSymbl", OBJPROP_COLOR, Yellow);

}

if( vO dS && dS != 0 )

{

ObjectCreate("DwnASymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("DwnASymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("DwnASymbl", OBJPROP_COLOR, White);

}

if( vO < vC && dB < dS && dB != 0 )

{

ObjectCreate("DwnBSymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("DwnBSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("DwnBSymbl", OBJPROP_COLOR, Red);

}

if( vO < vC && dS == 0 )

{

ObjectCreate("DwnCSymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("DwnCSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("DwnCSymbl", OBJPROP_COLOR, Yellow);

}

 

Identifying Candles

I'm trying to identify candles where, a buy candle has more selling than buying, and a sell candle has more buying than selling. I have the values , but drawing the arrows to mark the candle is a bit of a problem. The following code is suppose to draw a green down arrow, on the high ,of a sell candle, when there's more increases in the close price, than decreases; a white down candle when there's more decreases in the close price, than increases; and a yellow when there is only decreases.

For a buy candle, a red down arrow, when there's more decreases in the close price, than increases; a white down candle when there's more increases than decreases; and a yellow when there is only increases.

The code instead, is drawing a red up candle for each condition. I realize that there can be more than one arrow drawn on a candle due to changes in conditions. That's o.k. for now, I can deal with that later. Just trying to get the right candle to be drawn first. Not sure what I'm doing wrong.

Thanks!

vO = 5 min Open, vC = 5 min Close, dB = increase in Close, dS = decrease in Close

if( vO > vC && dB < dS && dB != 0 )

{

ObjectCreate("UpASymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("UpASymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("UpASymbl", OBJPROP_COLOR, White);

}

if( vO > vC && dB > dS && dS != 0 )

{

ObjectCreate("UpBSymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("UpBSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("UpBSymbl", OBJPROP_COLOR, Lime);

}

if( vO > vC && dB == 0 )

{

ObjectCreate("UpCSymbl"+Time[0], OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("UpCSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("UpCSymbl", OBJPROP_COLOR, Yellow);

}

if( vO dS && dS != 0 )

{

ObjectCreate("DwnASymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("DwnASymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("DwnASymbl", OBJPROP_COLOR, White);

}

if( vO < vC && dB < dS && dB != 0 )

{

ObjectCreate("DwnBSymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("DwnBSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("DwnBSymbl", OBJPROP_COLOR, Red);

}

if( vO < vC && dS == 0 )

{

ObjectCreate("DwnCSymbl"+Time[0] , OBJ_ARROW, 0, Time[0],High[0]);

ObjectSet("DwnCSymbl", OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet("DwnCSymbl", OBJPROP_COLOR, Yellow);

}

 

Text over Candle

Is it possible to write text above or below a candle? Current or past. Such as the volume of a candle written under or above the candle?

Thanks!

 

Drawing a Dot Question

O.k. I figured out how to draw an arrow over a candle.

ObjectCreate(StringConcatenate("DwnDSymblD",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);

ObjectSet(StringConcatenate("DwnDSymblD",TimeCurrent()), OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet(StringConcatenate("DwnDSymblD",TimeCurrent()), OBJPROP_COLOR, White);

Could someone show me how to make a dot instead of an arrow?

Thanks!

 
Yellowbeard:
O.k. I figured out how to draw an arrow over a candle.

ObjectCreate(StringConcatenate("DwnDSymblD",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);

ObjectSet(StringConcatenate("DwnDSymblD",TimeCurrent()), OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet(StringConcatenate("DwnDSymblD",TimeCurrent()), OBJPROP_COLOR, White);

Could someone show me how to make a dot instead of an arrow?

Thanks!

Hi Yellowbeard,

The symbols are called "wingdings"...and can be found in MT4's documentation...

Wingdings - MQL4 Documentation

Replace the Arrow codes with the symbol code of your choice.

Hope this helps,

Robert

Files:
 

Thanks cosmiclifeform,

That did the trick. Here's the code that works.

ObjectCreate(StringConcatenate("UpBSymblB",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);

ObjectSet(StringConcatenate("UpBSymblB",TimeCurrent()), OBJPROP_ARROWCODE, 108);

ObjectSet(StringConcatenate("UpBSymblB",TimeCurrent()), OBJPROP_COLOR, Lime);

Is there a way to add spacing between the dot and the high of the candle? So that the dot doesn't cover the candle.

Thanks again!

 
Yellowbeard:
Thanks cosmiclifeform,

That did the trick. Here's the code that works.

ObjectCreate(StringConcatenate("UpBSymblB",TimeCurrent()), OBJ_ARROW, 0, Time[0],vH);

ObjectSet(StringConcatenate("UpBSymblB",TimeCurrent()), OBJPROP_ARROWCODE, 108);

ObjectSet(StringConcatenate("UpBSymblB",TimeCurrent()), OBJPROP_COLOR, Lime);

Is there a way to add spacing between the dot and the high of the candle? So that the dot doesn't cover the candle.

Thanks again!

Hi Yellowbeard,

You can add "Distance" to your High/Low values as an extern User Setting...or use any name you want...

This will place the wingding above or below the bars...

Then you can adjust it as necessary by trying different values...

Here is a Stoch sample from a different indicator as an example:

StochEntryUp1 = Low - Distance;

StochEntryDown1 = High + Distance;

Hope this helps,

Robert