OPEN-SOURCE SCRIPT

Fib Speed Resistance Fan

"Fib Speed Resistance Fan," automatically draws Fibonacci Speed Resistance Fan lines based on the first and third candles of the trading session. Here’s a breakdown of its functionality:

Functionality
Session Start Time Identification

The script identifies the first candle at 9:15 AM using timestamp(), which ensures it captures the market's opening candle.
Candle Indexing

It determines the index of the first candle (firstCandleIndex) using ta.barssince(time >= sessionStart).
The third candle is found by adding two bars to the first candle's index (thirdCandleIndex = firstCandleIndex + 2).
Ensuring Single Execution

A boolean flag hasDrawn ensures that the lines are drawn only once and do not update on future candles.
Validating Data

It checks if the firstCandleIndex and thirdCandleIndex are valid (validSession).
If conditions are met, it extracts the highs and lows of the first and third candles.
Fibonacci Calculation

The script calculates a 0.75 level price between the first candle high/low and third candle low/high.
This level helps in drawing intermediate Fibonacci fan lines.
Drawing the Fibonacci Speed Resistance Fan

If conditions are valid and hasDrawn is false, the script draws:
Main fan lines from:
First candle high → Third candle low (Blue line)
First candle low → Third candle high (Blue line)

Disclaimer