- add user user-definable numeric parameter

Exploration / Indicators
(AmiBroker 4.30)

SYNTAX Param( ''name'', defaultval, min, max, step, sincr = 0 )
FUNCTION Adds a new user-definable parameter, which will be accessible via Parameters dialog :
right click over chart pane and select "Parameters" or press Ctrl+R allows to change chart parameters - changes are reflected immediatelly.

  • "name" - defines parameter name that will be displayed in the parameters dialog
  • defaultval - defines default value of the parameter
  • min, max - define minimum and maximum values of the parameter
  • step - defines minimum increase of the parameter via slider in the Parameters dialog
  • sincr - automatic section increment value (used by drag-drop interface to increase default values for parameters)

WARNING: default/min/max/step parameters have to be CONSTANT numbers. This is because these values are cached and are not re-read during subsequent formula evaluations.

IMPORTANT: Parameter names and values must NOT contain non-printable characters (ASCII codes < 32).

EXAMPLE Sample code 1:

ticker = ParamStr( "Ticker", "MSFT" );
sp = Param( "MA Period", 12, 2, 100 );
PlotForeign( ticker, "Chart of "+ticker, ParamColor( "Price Color", colorLightYellow ), styleCandle );
Plot( MA( Foreign( ticker, "C" ), sp ), "MA(" + WriteVal( sp, 1.0 ) + ")", ParamColor( "MA Color", colorRed ) );
Sample code 2:

sp = Param( "RSI Period", 12, 2, 100 );
r = RSI( sp );
Plot( r, "RSI("+WriteVal(sp,1.0)+")", ParamColor("RSI Color", colorRed ) );

Buy = Cross( r, 30 );
Sell = Cross( 70, r );

PlotShapes( shapeUpArrow * Buy + shapeDownArrow * Sell, IIf( Buy, colorGreen, colorRed ) );

SEE ALSO PARAMCOLOR() function , PARAMSTR() function PARAMCOLOR() function , ParamTime() function , ParamDate() function


Tomasz Janeczko
tj --at--
2006-02-19 06:18:23
Note that Parameters are INDEPENDENT for each chart pane and for Automatic Analysis window.
In Automatic Analysis window parameters can be modified using "Parameters" button and they are independent from ones you use for any chart.
Tomasz Janeczko
tj --at--
2006-02-19 06:19:59
To change the parameters for the indicator, please click with RIGHT mouse button over chart pane and select "Parameters" from the menu.


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

More information:

See updated/extended version on-line.