- Plot horizontal grid line

Exploration / Indicators
(AFL 2.3)

SYNTAX PlotGrid( level, color = colorDefault, pattern = 1, width = 1, Label = True )
FUNCTION Plots hotizontal grid line using built-in dotted style at given level, color, pattern, width, with or without Label.

New in version 5.90:

  • pattern - defines line pattern. Available grid patterns 1..10 as shown in the Tools->Preferences, "Axes & Grids", 1-7 are single pixel patterns, 8 is regular windows dot pattern (PS_DOT) , 9 is regular Windows dash pattern (PS_DASH), 10 is solid line
  • width - grid line width (in pixels). Note that due to Windows GDI limitations only patterns 8 (PS_DOT), 9 (PS_DASH), 10 (PS_SOLID) are available in widths > 1
  • label - whenever to display value label or not
Use PlotGrid to display horizontal lines that are constant instead of using Plot. PlotGrid offers much better performance in this case.

So instead of

Plot( 50, "", colorRed, styleLine | styleThick );


PlotGrid( 50, colorRed, 10, 2, False ); // solid line 2 pixels thick, no label

EXAMPLE PlotGrid( 25, colorRed );
SEE ALSO PLOT() function , PLOTFOREIGN() function , PLOTOHLC() function


Tomasz Janeczko
tj --at--
2003-04-18 07:12:14
Instead of number you can also use expression but it must
be NUMERIC expression, not ARRAY.

Use LastValue to convert:

your_expression = ...
PlotGrid( LastValue( your_expression ) );


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

More information:

Updated on-line reference