The SmartLevels generator calculates and displays Fibonacci-based support and resistance levels for the current trading day. It determines the day's high/low range and projects five key Fibonacci levels as horizontal lines.
Use a Controller object to add the generator to a chart:
const smartLevels = controller.addGenerator('SmartLevels');
The generator calculates five levels based on the current day's price range:
| Level | Fibonacci % | Formula |
|---|---|---|
level0 |
0.00% | Low |
level38 |
38.20% | Low + (Range × 0.382) |
level50 |
50.00% | Low + (Range × 0.500) |
level61 |
61.80% | Low + (Range × 0.618) |
level100 |
100.00% | High |
Where Range = High - Low for the current trading day.
Type: color
Default: 'rgba(36,142,247,1)' (blue)
Details
The color used for all level lines. Changing this updates all lines simultaneously.
Type: boolean
Default: false
Details
When enabled, the level direction is inverted. Normally the generator auto-detects a downward trend (when the day's open > current close) and flips the levels accordingly. This option allows overriding that behavior.
Type: boolean
Default: true
Details
When enabled, each level line displays a text label showing the price value and its Fibonacci percentage (e.g., "145.20 (Level 38.20%)").
Type: boolean
Default: true (all enabled)
Details
Individual toggles for each Fibonacci level. Disabling a level removes its line from the chart.
The generator scans from midnight of the current day to the latest candle to determine the day's high and low. It then calculates each Fibonacci level and draws horizontal lines starting at the first candle of the day.
Trend detection: If the day's open price is above the current close, the generator detects a downward trend and inverts the level positions (so that the 0% level is at the high and 100% at the low). The invert option can flip this detection.
The generator includes a legend entry showing the current value of each enabled level.