Arrows drawn behind candlestick bodies

 

Hello,

I'm trying to develop a script that draws arrows on a candlestick chart. I'm finding it somewhat tricky to position the arrows at a proper vertical position. First, I tried positioning the arrows at High[] for each bar. Sometimes, however, the body of the candlestick is drawn on top of the arrow and it is not visible. I then tried positioning the arrows some height above the high price, calculated as a fraction of the (high price - low price). In this case, the arrows would sometimes go off the screen (too high). Then, I tried setting the arrows at WindowPriceMax(). This worked really well for the bars on the screen, but when I scroll back in time, the arrows are not at the top of the screen and are, again, sometimes covered by the candlestick body or are above the screen top.

Does anyone know a simple solution for this? Perhaps another option is to somehow draw the arrows further in the foreground than the candlesticks, but I'm not sure how to control this.

Thanks!

James

 
jfortiv:

Hello,

I'm trying to develop a script that draws arrows on a candlestick chart. I'm finding it somewhat tricky to position the arrows at a proper vertical position. First, I tried positioning the arrows at High[] for each bar. Sometimes, however, the body of the candlestick is drawn on top of the arrow and it is not visible. I then tried positioning the arrows some height above the high price, calculated as a fraction of the (high price - low price). In this case, the arrows would sometimes go off the screen (too high). Then, I tried setting the arrows at WindowPriceMax(). This worked really well for the bars on the screen, but when I scroll back in time, the arrows are not at the top of the screen and are, again, sometimes covered by the candlestick body or are above the screen top.

Does anyone know a simple solution for this? Perhaps another option is to somehow draw the arrows further in the foreground than the candlesticks, but I'm not sure how to control this.

Thanks!

James


because the price move you need to move your arrow also, when the bar is not closed.

Maybe a new high/low is building, then your arrow is inside the bar.

So - draw the arrow over high and re-draw when price is moving?!

For me is working good enough like this!

 
EADeveloper:


because the price move you need to move your arrow also, when the bar is not closed.

Maybe a new high/low is building, then your arrow is inside the bar.

So - draw the arrow over high and re-draw when price is moving?!

For me is working good enough like this!


Thanks for your reply. I think this works great when drawing arrows on new bars, right? My intention is to draw arrows on already completed bars and be able to scroll back and see those arrows. This is a script, not an EA. I have no start() function. So, maybe if I could somehow force a redraw on scrolling back? I'm not sure if this is possible. Any input would be appreciated.


Thanks.

 
Make it an indicator instead of a script.