Font size for the PlotShape

Hello Team,
When I use the following code it plots the shape on the candle which is extremely big.

PlotShapes( IIF(borat>-50&&borat<50, shapeNone,shapeStar + shapePositionAbove ), 2,layer = 0, yposition = graph3, offset = -20 ); 


image

I wish to reduce the size of the shape, how can this be possible.

You can't reduce or enlarge the size of shapes plotted by PlotShape (at least I don't know how), but you can always choose another, smaller shape. Take a look here to find out what shapes are available:

http://www.amibroker.org/userkb/2008/03/15/afl-shapes-cheat-sheet/

... or try out this simple afl allowing you to quickly browse through all 58 shapes using Param slider:

Condition = BarIndex() % 5 == 0; // Every 5th candle
Shape = Param( "Shape", 1, 1, 58, 1 );
PlotShapes( Condition*Shape, colorGreen, 0, H );

All pre-defined shapes (like ShapeUpArrow, ShapeSmallCircle etc.) have their numbers (ranging from 1 to 58). Odd values plot shape BELOW indicator, even values plot shape ABOVE indicator.

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

3 Likes

@Milosz thanks for the link, I had not seen that before. On a related topic there is the capability of using "wingdings" typeface. (since v 5.80)
https://www.amibroker.com/guide/afl/plottextsetfont.html

and

3 Likes

It is not just "Wingdings". There are also UCN/Unicodes (since AB 5.94).

The closest to (similar) star is this unicode (and by setting font size you can make it smaller).

"\u2731"

->

Plot( C, "Price", colorDefault, styleCandle );
PlotTextsetfont("\u2731", "Symbola", size = 8, BarCount-1, LastValue(L), colorRed, -1, -15 );

03

Links to Tables

http://unicode-table.com/en
http://www.unicodemap.org/
http://www.unicode.org/

Arrows:

Enclosed alphanumerics:

10 Likes

Larry, Fxshrat, thanks for the reply. In this case OP was asking specifically about using PlotShapes().

@krishnakhanna - PlotShapes() is the simplest (single line) way of marking all bars meeting some criteria in one go. Apart from it there are of course other ways of marking these spots on the chart (giving much more visual possibilities - Gfx functions, PlotText etc.), but the main difference is that in this case, you need to provide specific coordinates of each spot (usually you iterate through all visible bars). Some examples:

... and many others which you can find on the forum ...

3 Likes

He was asking about PlotShapes because he doesn't know better.
But based on his picture what he actually wants is smaller stars. Since shapes such as shapeStar can't be made smaller he has to use PlotTextSetFont for that.

BTW, there does exist Code Snippets feature.

period = 20; 
m = MA( Close, period );
Buy = Cross( Close, m );
Sell = Cross( m, Close ); 

Plot( C, "Price", colorDefault, styleCandle );

bi = Barindex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );

shape_star = "\u2731";
dist = 15;

PlotTextSetFont("", "Symbola", size = 8, lvb, 0, -1 );
for ( i = fvb; i <= lvb; i++ ) {
	if ( Buy[i] )	PlotText( shape_star, i, L[i], colorGreen, -1, -dist );
	if ( Sell[i] )	PlotText( shape_star, i, H[i], colorRed, -1, dist );
}

Small enough? (Looks like shapeSmallCircle -> Let's go back to PlotShapes. lol)
35

4 Likes

Thank you, This will be helpful. I will go through the details provided by you.

Thank you @Milosz , The examples you have quoted will guide me further. Will study these further.

1 Like

hank you for providing me such details for the indicator, let me check these and use it accordingly.

For me, the problem is the shapes print way too small.

AB%20Tiny%20Shapes

Working with UniCode does allow one to plot larger shapes (thank you, @fxshrat), but, man, it's not as easy as PlotShapes().

Sorry but currently PlotShapes() is bitmap-based. So its pixel size is fixed and appears small on Hi-DPI screens. As pointed out by others PlotTextSetFont provides alternative using symbol fonts like Windings, Webdings, Symbola and others.

4 Likes