SetLevelValue
Changes the value of an existing level line.
Syntax
SetLevelValue(index: number, value: number): void
Parameters
index
- A number representing the index of the level to modify.value
- A number representing the new Y-value for the level.
Return Value
This method does not return a value.
Description
The SetLevelValue
method changes the Y-value of an existing level line. This can be used to dynamically adjust level positions based on market conditions or user preferences.
Example
// Change the first level (index 0) to value 75
this.api.SetLevelValue(0, 75)
// Change the second level (index 1) to value 25
this.api.SetLevelValue(1, 25)
// Dynamically adjust levels based on volatility
const volatility = this.api.iATR('EURUSD', 14, 0)
this.api.SetLevelValue(0, 50 + volatility * 2)
this.api.SetLevelValue(1, 50 - volatility * 2)
Last updated