Fibonacci Retracement & Extension

Fibonacci retracement and extension price levels of the high-to-low range of recent candles.

Fibonacci levels of the range of period candles that end from candles back: from = 1 (default) uses the previous candles only, the current candle is EXCLUDED; from = 0 includes it. Retracements r = 0.236, 0.382, 0.5, 0.618, 0.786: up_N = retracement of an up move, measured down from the high (high − r × range); down_N = retracement of a down move, measured up from the low (low + r × range). Extensions r = 1.272, 1.618, 2.618: ext_N = extension of an up move above the high (low + r × range, e.g. ext_1618 = the 1.618 extension); ext_down_N = extension of a down move below the low (high − r × range). Ready at period + from candles. Mirror: high ↔ low, up_N ↔ down_N, ext_N ↔ ext_down_N.

Settings

SettingDefaultRangeWhat it does
period502 to 1000Candles in the window.
from10 to 1000Candles back where the window ends (1 = current excluded).

What it gives

OutputWhat it is
Range highHighest high of the window.
Range lowLowest low of the window.
23.6 % retracement from the highhigh − 0.236 × (high − low).
38.2 % retracement from the highhigh − 0.382 × (high − low).
50 % retracement from the highhigh − 0.5 × (high − low).
61.8 % retracement from the highhigh − 0.618 × (high − low).
78.6 % retracement from the highhigh − 0.786 × (high − low).
23.6 % retracement from the lowlow + 0.236 × (high − low).
38.2 % retracement from the lowlow + 0.382 × (high − low).
50 % retracement from the lowlow + 0.5 × (high − low).
61.8 % retracement from the lowlow + 0.618 × (high − low).
78.6 % retracement from the lowlow + 0.786 × (high − low).
127.2 % extension above the highlow + 1.272 × (high − low): above the high.
161.8 % extension above the highlow + 1.618 × (high − low): above the high.
261.8 % extension above the highlow + 2.618 × (high − low): above the high.
127.2 % extension below the lowhigh − 1.272 × (high − low): below the low.
161.8 % extension below the lowhigh − 1.618 × (high − low): below the low.
261.8 % extension below the lowhigh − 2.618 × (high − low): below the low.

What it reads

It reads the whole candle (open, high, low, close and volume).

Warm-up

With its default settings, Fibonacci Retracement & Extension needs 51 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses Fibonacci Retracement & Extension with its default settings