Arrow Position on Chart

 

Hallo Everybody,

actual i have a problem with the position of Arrow's on the Chart.

As you can see it on the Screenshot i placed a arrow on pricelevel 115.00.
But now the Arrow is placed on Price Level 114.68 (i drawed the 2 blue lines to show the problem).
It seems as if the price level of a arrow representate the top borderline of the box which has any arrow.

I tried to manipulate the price level around 10 or 15 Pips but that depends on the underlying, so thats no alternive.
Is there any possibility to place a arrowhead at the destination price level?

Thanks in advance,
f.


 

(When calculating the 'arrow margin', do it somewhere separate from the placing of the indicator, maybe in a separate function. That way, you can play with it without interfering with the business logic)

A) Use parameter like

extern int ArrowMargin = 5;

B) Use code like

   double priceMax = WindowPriceMax(0);
   double priceMin = WindowPriceMin(0);
   double priceSpan = priceMax - priceMin;

and use a percentage of the vertical space for the arrow margin, e.g.

   double arrowMargin = priceSpan * 2.0 / 100.0; // place arrow 2% above High/below Low

Note that priceSpan will vary as the chart is scrolled, and the indicator won't redraw unless you tell it to.

C) Use code to calculate pips margin base on timeframe. e.g.

   if (Period() == PERIOD_M15) 
      gd_ArrowSpace = 4.0 * Point;
   if (Period() == PERIOD_M30) 
      gd_ArrowSpace = 6.0 * Point;
   if (Period() == PERIOD_H1) 
      gd_ArrowSpace = 8.0 * Point;

('switch' would be better but I just copied-and-pasted some code I found)