PlotShapes offset, was: How to line up the shapes

How do i line up my shapedowntriangle below ?
as you can see the number shapes and the smalluptriangle are all lined up in nice rows. but the shapesmalldowntriangle is located way above the top.

Plot(0,"test",colorRed,styleLine);
PlotShapes(  shapeDigit0, colorGold, 0, Graph0, 0 );
PlotShapes(    shapeDigit1   , colorGold, 0, Graph0, -10 );
PlotShapes(   shapeDigit2  , colorGold, 0, Graph0, -20 );
PlotShapes(   shapeDigit3   ,colorGold, 0, Graph0, -30 );
PlotShapes( shapeDigit4  , colorGold, 0,  Graph0, -40 );
PlotShapes(  shapeDigit5   , colorGold, 0, Graph0, -50 );
PlotShapes(   shapeDigit6   ,  colorGold, 0,  Graph0, -60 );
PlotShapes(  shapeSmallUpTriangle    ,  colorGold, 0,  Graph0, -70 );

PlotShapes(  shapeSmallDownTriangle  , colorGold, 0,  Graph0 , -80 );

1 Like

Reduce the parameter from -80 to -20 of triangle

interesting to know. i have 2 shares at the same level -20 but they show in different stops. :wink:

"Up" and "down" shapes have built-in vertical offset so they automatically appear below / above candles making charts with arrows more readable.

is this offset based on Graph0?

Y position is based on whatever you pass to PlotShapes function plus offset. It is all documented precisely in the manual: http://www.amibroker.com/guide/afl/plotshapes.html

In your code you told it to use -70 offset and -80 offset but this offset is added OR subtracted depending if you are using "Down" or "Up" shape. Therefore in your code you should be using 80 as offset for shapeSmallUpTriangle.

Second thing is that PlotShapes function is not intended to be used for anything but drawing shapes like arrows around actual chart lines. One should avoid drawing it every bar as with 10000+ bars it would cause way too much overload for little purpose (drawing over and over same pixels).

For drawing any shape for any different purpose in precise pixel X/Y location you should be using PlotText and PlotTextSetFont or Gfx functions.

https://www.amibroker.com/guide/afl/plottextsetfont.html