SetChartOptions
- set/clear/overwrite defaults for chart pane options

Exploration / Indicators
(AmiBroker 4.70)


SYNTAX SetChartOptions( Mode = 0, Flags = 0, gridFlags = chartGridMiddle, ymin = 0, ymax = 0, blankbars = 0 )
RETURNS NOTHING
FUNCTION Allows to set/clear/overwrite/set defaults for chart pane options
  • Mode - specifies how options are set:
    • 0 - set only the DEFAULT values for new chart. Defaults are applied only once when chart is inserted in a new pane, so later you can modify any option using Indicator Builder
    • 1 - overwrite - the values specified in 2nd and 3rd argument overwrite any previously set values
    • 2 - set flag - flags specified in 2nd and 3rd parameter are binary-ORed with the current values, so effectively these options are set while remaining are unchanged
    • 3 - reset flag - flags specified in 2nd and 3rd parameter are cleared while the others remain unchanged.
  • Flags - allowable flags are:
    chartShowDates, chartLogarithmic, chartShowArrows, chartWrapTitle (4.75 or higher), chartHideQuoteMarker (v5.06). chartHideQuoteMarker - hides the quote selector line on per-pane basis, the same as Parameter dialog -> Axes & Grid -> Vert. quote marker: Show/Hide, chartDisableYAxisCursor (new in 5.80) - disables changing mouse pointer to up/down arrow when hovering above Y axis, chartDisableTooltips (new in 5.80) - disables displaying tooltips (data tips).
  • gridFlags - (for internal AmiBroker use - do not use it in your own coding as this parameter will be eventually removed) allowable values are: chartGridDiv100, chartGridPercent, chartGridDiv1000, chartGridMargins chartGridMiddle, chartGrid0, chartGrid30, chartGrid70, chartGrid10, chartGrid90, chartGrid50,chartGrid100,chartGrid20,chartGrid80,chartGrid1
  • ymin, ymax - (new in 5.07) these parameters specify Y-axis minimum and maximum values for custom scaling. If you specify any values that meet the condition ymin < ymax, AmiBroker will turn OFF automatic scaling and use specified min/max values for Y scale. Note that Mode argument controls when these settings are applied (0 - only when new chart is created, 1 - always), when modes 2 and 3 are used - scaling is not changed.
  • blankbars - (new in 5.30) defines the minimum number of blank bars for given chart. The default value of zero means no change (use preferences setting).
    If specified value is less than value set in preferences, it is ignored, so you can not decrease the blank bars below value set in preferences.
    If many panes within same chart use this function, then the largest specified blankbars will be used

    Note that you can still extend blank space further using END key. Special feature - if "blankbars" is negative then extra blank bars added are equal to absolute value of blankbars parameter plus chart gets scrolled to rightmost position.

    Caveat: forcing custom blankbars via SetChartOptions effectivelly disables HOME key scroll to begin operation.

EXAMPLE //to mark "Show arrows" by default in a new chart use
SetChartOptions( 0, chartShowArrows );

Example 2 (works only with version 4.75 or higher):

SetChartOptions(2, chartWrapTitle );
Title="this is a test of automatic wrapping of title text that is too long to fit in single line, for that reason this sample formula uses very long text. I hope you are enjoying the sample";

SEE ALSO

References:

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

More information:

See updated/extended version on-line.