PlotShapes
- plots arrows and other shapes

Exploration / Indicators
(AmiBroker 4.30)


SYNTAX PlotShapes( shape, color, layer = 0, yposition = graph0, offset = -12, XShift = 0 );
RETURNS NOTHING
FUNCTION Plots arrows and other shapes on any chart pane.

Parameters:

  • shape defines type of the symbol. when shape is zero nothing is plotted values other than zero cause plotting various pre-defined shapes. Odd values plot shape BELOW indicator, even values plot shape ABOVE indicator.
  • color defines color of shape
  • layer defines layer number on which shapes are plotted
  • yposition defines Y-position where shapes are plotted (by default they are plotted 'around' graph0 (first indicator) line)
  • offset - (or distance) parameter (by default -12 ), Offset is expressed in SCREEN pixels. Negative offsets shift symbols down, positive offsets shift symbol up. To place the shape exactly at ypostion, specify 0 as offset
  • (new in 5.66) XShift - allows to visually shift the the shapes by the specified number of bars (even past the last bar).
Constants for shapes:

shapeNone, shapeUpArrow, shapeDownArrow, shapeHollowUpArrow, shapeHollowDownArrow, shapeSmallUpTriangle, shapeSmallDownTriangle, shapeHollowSmallUpTriangle, shapeHollowSmallDownTriangle, shapeUpTriangle, shapeDownTriangle, shapeHollowUpTriangle, shapeHollowDownTriangle, shapeSmallSquare, shapeHollowSmallSquare, shapeSquare, shapeHollowSquare, shapeSmallCircle, shapeHollowSmallCircle, shapeCircle, shapeHollowCircle, shapeStar, shapeHollowStar, shapeDigit0, shapeDigit1, shapeDigit2, shapeDigit3, shapeDigit4, shapeDigit5, shapeDigit6, shapeDigit7, shapeDigit8, shapeDigit9, shapePositionAbove

EXAMPLE Example 1:

PlotShapes( IIF( buy, shapeDigit9 + shapePositionAbove, shapeNone ), colorGreen );

Example 2:

Graph0=MACD();
Graph1=Signal();
Buy=Cross(Graph0, Graph1);
Sell=Cross(Graph1, Graph0);
PlotShapes( ( Buy OR Sell ) * ( 1 + Cum( Buy OR Sell ) % 52 ), IIf( Buy, colorGreen, colorRed ), 5 );
GraphXSpace = 5;

SEE ALSO PLOT() function

Comments:

Tomasz Janeczko
tj --at-- amibroker.com
2003-07-01 09:31:04
You can position your arrows relative to High/Low too. See the code below for the example:

Buy=Cross(MACD(), Signal());

Sell=Cross(Signal(), MACD());

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

Plot( Close, "Price", colorBlack, styleCandle );

PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

GraphXSpace = 5;
Tomasz Janeczko
tj --at-- amibroker.com
2006-06-07 17:14:40
ShapePositionAbove must NOT be used together with shapes that have positions already
included (all those which have "Down" or "Up" in the name).
All "Down" shapes are positioned ABOVE already and "Up" shapes are positioned BELOW already,
so it makes no sense to add those two.

So you may only use ShapePosition above to the following shapes:
shapeSmallSquare, shapeHollowSmallSquare, shapeSquare, shapeHollowSquare, shapeSmallCircle, shapeHollowSmallCircle, shapeCircle,
shapeHollowCircle, shapeStar, shapeHollowStar, shapeDigit0, shapeDigit1, shapeDigit2, shapeDigit3, shapeDigit4, shapeDigit5,
shapeDigit6, shapeDigit7, shapeDigit8, shapeDigit9

References:

The PlotShapes function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.