setDefaultPrecision()

ICE Data Services -

setDefaultPrecision() preMain Functions

 

This function sets the number of decimals for the returned series by a script. You would use setDefaultPrecision() to set the number of decimals for each series that your script returns.

Syntax

setDefaultPrecision( Number [, SeriesIndex ] )

Parameters

Parameter: Description: Default:
Number An integer representing the number of decimals for the returned series. Is in the range [0, 6]. n/a
SeriesIndex [Optional]  An integer identifying the return index from main(). 0

Notes

Only available in versions 11.8 or later.

 

Code Examples

function preMain() {
  setPriceStudy(true);
  setStudyTitle("Example Script");
  setCursorLabelName("EMA", 0);
  setCursorLabelName("SMA", 1);
  setCursorLabelName("WMA", 2); //this script returns 3 series.
  //use setDefaultPrecision() to set the number of decimals
  //for each return series
  setDefaultPrecision(4, 0);
  setDefaultPrecision(4, 1);
  setDefaultPrecision(4, 2);
  setShowTitleParameters(false);
}

See Also

setCursorLabelName()
setShowCursorLabel()
setPlotType()