QuantiX Fibonnaci Expansion
This implementation of Fibonacci expansion generates support and resistance levels. It returns two sets of outputs:
uptrend levels: fibxut236, fibxut500, fibxut786, fibxut1000, fibxut1618
downtrend levels: fibxdt236, fibxdt500, fibxdt786, fibxdt1000, fibxdt1618
The uptrend levels are used are potential resistance levels in an uptrend and the downtrend levels are potential support levels in a downtrend. These levels are generated using previous pivots ( two low pivots and one high pivot for downtrend levels and two high pivots and one low pivot for uptrend levels). The inputs of this function are:
Timeframes: The timeframe(s) in which the function is applied
Look Back Window Length: The number of candles the function considers in the past to find pivots
Confirmation Lag: The number of candles the function waits to confirm a pivot; note that as this parameter becomes larger, the lag of the system also increases, but pivots become more reliable.
High Pivots Source: The source used for finding high pivots
Low Pivots Source: The source used for finding low pivots
Output(s) Column Name(s): The names given to the outputs; the uptrend levels names start with fibxut and end with the Fibonacci coefficient the output is associated with. Likewise, the downtrend levels names start with fibxdt and end with the Fibonacci coefficient the output is associated with.
Example
The default settings are used to find Fibonacci expansion levels. The colored lines are levels calculated by the function, and the colorful region is Fibonacci expansion levels drawn by the Fib Expansion tool in tradingview. As is seen, they match each other.