Arrows/ObjectCreate overwriting Bars..

Back to topics list To post a new topic, please log in or register
avatar
127
wemersonrv 2015.06.17 17:22
 

I am printing some arrows on the graphics.. Only for learning purposes...

As you can see on the image below, There are times, that the arrow is over the bar. There are a way to print the arrows more distant (upper or down) to the bar end?

Arrows 

 

ObjectCreate(0, name, OBJ_ARROW, 0, Time[shift], High[shift], 0, 0); 

 

  

avatar
736
honest_knave 2015.06.17 17:35 #
 

ANCHOR_TOP and ANCHOR_BOTTOM are options for OBJ_ARROW

More than that and you will need to add spacing to the High / Low values manually 

 

 

avatar
127
wemersonrv 2015.06.17 18:35 #
 

I try this before... whan anchored to a bar with smaill tail, overwites the bar...

 

To do this manually I try but not works... 

 

ObjectCreate(0, name, OBJ_ARROW, 0, Time[shift], High[shift] * 1.2); 

For example when print on a Upper candle, try to increase the value returned by High[shift] in 20% expecting the arrow be printed mor above, but not works!

avatar
736
honest_knave 2015.06.17 21:53 #
 

If you anchor your top arrows with ANCHOR_BOTTOM and your bottom arrows with ANCHOR_TOP you shouldn't get any overlap.

 

Failing that, use Point to get your distances. 

avatar
127
wemersonrv 2015.06.17 22:32 #
 

Yes the print was made a couple of candles after the arrows printed... but the code is right...

if( cmd == CMD_DOWN ) {

   ObjectCreate(0,name,OBJ_ARROW,0,Time[shift],Low[shift]);

   ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_BOTTOM);

   ObjectSetInteger(0,name,OBJPROP_ARROWCODE, 236);

   ObjectSetInteger(0,name,OBJPROP_WIDTH, 2);

   ObjectSetInteger(0,name,OBJPROP_COLOR, clrGreen); 

} 

 

if( cmd == CMD_UP ) {

   ObjectCreate(0,name,OBJ_ARROW,0,Time[shift],High[shift]);

   ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_TOP);

   ObjectSetInteger(0,name,OBJPROP_ARROWCODE, 238);

   ObjectSetInteger(0,name,OBJPROP_WIDTH, 2);

   ObjectSetInteger(0,name,OBJPROP_COLOR, clrRed);  

} 

ChartRedraw(0);
avatar
736
honest_knave 2015.06.17 22:46 #
 

Your code is not quite right. Here are the changes:

 

if( cmd == CMD_DOWN ) {

   ObjectCreate(0,name,OBJ_ARROW,0,Time[shift],Low[shift]);

   ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_TOP);

   ObjectSetInteger(0,name,OBJPROP_ARROWCODE, 236);

   ObjectSetInteger(0,name,OBJPROP_WIDTH, 2);

   ObjectSetInteger(0,name,OBJPROP_COLOR, clrGreen); 

} 

 

if( cmd == CMD_UP ) {

   ObjectCreate(0,name,OBJ_ARROW,0,Time[shift],High[shift]);

   ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_BOTTOM);

   ObjectSetInteger(0,name,OBJPROP_ARROWCODE, 238);

   ObjectSetInteger(0,name,OBJPROP_WIDTH, 2);

   ObjectSetInteger(0,name,OBJPROP_COLOR, clrRed);  

} 
avatar
127
wemersonrv 2015.06.18 02:35 #
 

Ok, now works!

My bad,  i do not understood the anchor... If I am getting the Higher price on the candle to place the arrow position ( High[shift] ), that is on the candle top... I do not understand why should i anchor on bottom (Higher[shift] x ANCHOR_BOTTOM)....

But it's working... The only thing that matters is the result!

 

Thanks my friend!

avatar
736
honest_knave 2015.06.18 08:20 #
 
wemersonrv:

Ok, now works!

My bad,  i do not understood the anchor... If I am getting the Higher price on the candle to place the arrow position ( High[shift] ), that is on the candle top... I do not understand why should i anchor on bottom (Higher[shift] x ANCHOR_BOTTOM)....

But it's working... The only thing that matters is the result!

 

Thanks my friend!

It is confusing - the anchor refers to which part of the arrow (not the candle) you want to pin to the spot defined by price/time.
avatar
127
wemersonrv 2015.06.18 22:18 #
 
honest_knave:
It is confusing - the anchor refers to which part of the arrow (not the candle) you want to pin to the spot defined by price/time.

Ok... thanks... I'ts working fine!

 

Back to topics list  

To add comments, please log in or register