OPEN-SOURCE SCRIPT

Fibonacci + TP/SL Strategy [Backtest]

1 091
✅ Key Features Added and Adjusted:
Fibonacci Retracement Levels:

Automatically calculated based on the last 100 bars' high/low

Plotted levels: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%

Extension targets: 161.8%, 261.8%, 423.6%

Buy/Sell Signal Logic:

Buy: Price is between 78.6% and 38.2% levels

Sell: Price is between 61.8% and 23.6% levels

Both depend on a can_trade time filter to avoid overtrading

ATR-based Stop-Loss:

Stop-loss dynamically adapts to market volatility:

SL = Entry - ATR * 1.5 (long)

SL = Entry + ATR * 1.5 (short)

Fixed Take-Profit:

Configurable via input: default is 4%

Can be changed in TradingView UI

Golden/Death Cross Indicator (Visual Only):

EMA 50 crossing EMA 200 plotted on chart:

Golden Cross = Buy signal (green triangle)

Death Cross = Sell signal (red triangle)

Weekly Profit Cap:

Prevents new trades if weekly profit exceeds 15%

Resets at the start of every week

Visual Elements:

All Fibonacci levels are plotted

Buy/Sell signals are labeled on the chart (BUY, SELL)



Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.