setBar()

ICE Data Services -

setBar()
Previous  Top  Next

setBar( type, barIndex, seriesIndex, value )
setBar( type, barIndex, value | arrayOfValues )

This function allows you to adjust the value and/or the properties of a prior bar of a study being displayed. For example, if you are calculating and displaying 2 moving average studies in your script, you could use the setBar() function to change the actual value, color, line style or thickness of a previously-displayed value from either one of the studies or even both of the studies.


Parameters

type
see Valid Types below
barIndex
the bar index of the bar to modify
seriesIndex
the index into the array of return values
value
the new value (or array of values)


Valid Types

Bar.Value
change the value of a prior bar
Bar.Style
change the line style of a prior bar
Bar.FgColor
change the foreground color of a prior bar
Bar.BgColor
change the background color of a prior bar
Bar.Thickness
change the line thickness of a prior bar


Usage
//set the value of the prior bar of the first study you are returning
//from your script to 22.
setBar( Bar.Value, -1, 22 );

//set the value of the prior bar of the 4th study you are returning 
//from your script to 25.
setBar( Bar.Value, -1, 3, 25 );

//set the line style of the third study returned from your script to PS_SOLID (3 bars ago)
setBar( Bar.Style, -3, 2, PS_SOLID );

//Assume your script is returning 3 values to be plotted. The following code will change 
//the backround color of each study (at a point 10 bars ago) to blue, green and yellow respectively. 
setBar( Bar.BgColor, -10, new Array( Color.blue, Color.green, Color.yellow ) );