Summary
Yes, you can build Fibonacci retracement logic in the Builder.
The key is to stop thinking of Fibonacci as a special tool and start thinking of it mechanically:
Choose two price points → Calculate the distance between them → Multiply that distance by a Fibonacci ratio → Create a price level → Use that level in your trade logic
This article shows how to build a 61.8% Fibonacci retracement level using Variables, Formula blocks, and Trade Rule blocks.
Also known as: Fibonacci retracement, 61.8 level, Fib entry, Fibonacci pullback, Fib strategy, custom Fibonacci logic, rebuild Fibonacci indicator.
The core idea
A Fibonacci retracement needs two anchor points.
Usually, these are:
Swing Low Swing High
or:
Price Low Price High
The most important question is:
From where to where is the Fibonacci measured?
If you do not define the start and end point clearly, the bot cannot calculate the level correctly.
Step 1: Define the two price points
First, decide which high and low you want to use.
Example variables:
Price_High = 0 Price_Low = 0
You can store these using candle or market properties.
Example:
Price_High = highest high of the last 20 candles Price_Low = lowest low of the last 20 candles
Or:
Price_High = Candle High ID 2 Price_Low = Candle Low ID 5
The exact logic depends on your strategy.
Step 2: Calculate the range
The range is the distance between the high and low.
Use a Formula block:
Range = Price_High - Price_Low
Important:
Price_High and Price_Low are price levels. Range is a price distance.
Step 3: Apply the Fibonacci ratio
For a 61.8% level, use:
Fib_Offset = Range × 0.618
This gives you the Fibonacci distance.
Step 4: Calculate the Fibonacci level
Now convert the distance into an actual price level.
This depends on how you want to measure the retracement.
Bullish retracement example
If price moved up from Price_Low to Price_High and you want the 61.8% pullback level below the high:
Fib_618 = Price_High - (Range × 0.618)
Example:
Price_Low = 1.08000 Price_High = 1.10000 Range = 0.02000 Fib_618 = 1.10000 - (0.02000 × 0.618) Fib_618 = 1.08764
Measuring 61.8% upward from the low
If you want the level that sits 61.8% of the way from low to high:
Fib_618 = Price_Low + (Range × 0.618)
Example:
Price_Low = 1.08000 Price_High = 1.10000 Range = 0.02000 Fib_618 = 1.08000 + (0.02000 × 0.618) Fib_618 = 1.09236
Both formulas can be valid, but they answer different questions. Define your Fibonacci direction first.
Step 5: Use the Fibonacci level in your logic
Once Fib_618 is calculated, it becomes a price level.
You can use it in a Trade Rule:
Bid crosses above Fib_618 → Buy Now
or:
Ask touches Fib_618 → Buy Pending Order
You can also use it as a custom entry level, target level, or filter.
Example structure
Create Variables: Price_High = 0 Price_Low = 0 Range = 0 Fib_618 = 0 Run per Candle → Modify Variables: Price_High = highest high of last 20 candles → Modify Variables: Price_Low = lowest low of last 20 candles → Formula: Range = Price_High - Price_Low → Formula: Fib_618 = Price_High - (Range × 0.618) → Trade Rule: Bid crosses above Fib_618 → Count Trades: Buy trades = 0 → Buy Now
Price level vs price distance
This matters.
Price_High = price level Price_Low = price level Range = price distance Fib_Offset = price distance Fib_618 = price level
Use the final Fib_618 level when comparing price or placing a pending order.
Do not confuse the Fibonacci offset with the final Fibonacci price level.
Make it your own
You can change the same logic for different levels:
Fib_382 = Price_High - (Range × 0.382) Fib_500 = Price_High - (Range × 0.500) Fib_618 = Price_High - (Range × 0.618)
You can also change how the high and low are selected:
Last 20 candles
Previous session high/low
Previous day high/low
Swing high and swing low
Manually defined candle IDs
Custom fractal logic
👉 Try the full example template here:
Open Fibonacci Calculation Example
Common mistakes
Not defining the anchor points
Fibonacci only works if the bot knows the start and end of the move.
Define exactly which high and low should be used.
Using the wrong formula direction
For an upward move, decide whether you want:
High - Range × ratio
or:
Low + Range × ratio
They are not the same level.
Treating the range as the final price
Range × 0.618 is only a distance.
You still need to add or subtract it from a real price point to get the final Fibonacci level.
Not testing visually
Export and test in MT5 Visual Mode.
Show your variables on the chart if needed and confirm that Price_High, Price_Low, and Fib_618 are calculated correctly.
Conclusion
Fibonacci retracement logic can be built with Variables and Formula blocks.
The process is:
Define high and low → Calculate range → Apply Fibonacci ratio → Create final price level → Use that level in Trade Rules
The hardest part is not the formula. The hardest part is defining exactly which swing high and swing low your bot should use.

