Strategy · Pine Script v5 · On the chart

Volume + Fibonacci + Trend + ATR Strategy with 1% TP

by 11Muhil

This strategy plots Fibonacci retracement levels from a rolling high-low range and trades long only on the price chart.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code56
Settings7inputs
LicenceMIT
Last update1 year ago11 Feb 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

56 lines of Pine Script v5 from Scripts/FibTrend_1%_TP.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

FibTrend_1%_TP.pine
//@version=5
strategy("Volume + Fibonacci + Trend + ATR Strategy with 1% Take Profit", overlay=true)

// Input settings
length = input(24, title="Volume Lookback Period")
fibLevel1 = input(0.618, title="Fibonacci Level 1")
fibLevel2 = input(0.5, title="Fibonacci Level 2")
riskReward = input(2.0, title="Risk to Reward Ratio")
smaLength = input(200, title="SMA Length for Trend Filter")  // Trend filter with SMA
atrLength = input(14, title="ATR Length")  // ATR for dynamic take profit

// Calculate 24-hour average volume
volume24 = ta.sma(volume, length)

// Identify volume surges (when current volume exceeds the 24-hour average)
volumeCondition = volume > volume24

// Calculate Fibonacci retracement levels for the last 50 bars
var float highLevel = na
var float lowLevel = na
lookbackPeriod = input(50, title="Fibonacci Lookback Period")
if (bar_index >= lookbackPeriod)
    highLevel := ta.highest(high, lookbackPeriod)
    lowLevel := ta.lowest(low, lookbackPeriod)

// Calculate Fibonacci retracement levels
fib618 = lowLevel + (highLevel - lowLevel) * fibLevel1
fib50 = lowLevel + (highLevel - lowLevel) * fibLevel2

// Plot Fibonacci levels on the chart
plot(fib618, color=color.red, title="Fib 0.618")
plot(fib50, color=color.blue, title="Fib 0.5")

// Trend filter using a simple moving average (SMA)
sma200 = ta.sma(close, smaLength)

// Buy condition: Price is above the 0.618 Fibonacci level, volume condition, and price is above SMA200
buyCondition = close > fib618 and volumeCondition and close > sma200
if (buyCondition)
    strategy.entry("Buy", strategy.long)

// Sell condition: Price falls below the 0.5 Fibonacci level, indicating potential reversal
sellCondition = close < fib50 and volumeCondition
if (sellCondition)
    strategy.close("Buy")

// Set dynamic take profit using ATR for a more adaptive target
atr = ta.atr(atrLength)
takeProfitPriceATR = strategy.position_avg_price + atr * riskReward  // Dynamic target based on ATR

// Set take profit at 1% above entry price
takeProfitPrice1Pct = strategy.position_avg_price * 1.01  // 1% take profit

// Exit: Either take profit at 1% or ATR-based take profit
strategy.exit("Take Profit 1%", from_entry="Buy", limit=takeProfitPrice1Pct)
strategy.exit("Take Profit ATR", from_entry="Buy", limit=takeProfitPriceATR, stop=fib50)

Overview

Volume + Fibonacci + Trend + ATR Strategy with 1% TP enters when price is above the first Fibonacci level, volume exceeds its moving average, and price is above a simple moving average. It closes the long when price falls below the second Fibonacci level during a volume surge. Take-profit exits use a fixed one percent target or an ATR multiple of the risk-to-reward setting; the ATR exit also uses the second Fibonacci level as a stop. Lookback lengths, Fibonacci ratios, SMA period, ATR length, and the reward multiple are adjustable.

Details

Published by

11Muhil on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Trend, Volatility & bands, Volume, Support & resistance

Markets

Forex, Crypto, Stocks

Timeframes

H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Volume Lookback Periodint24length
Fibonacci Level 1float0.618fibLevel1
Fibonacci Level 2float0.5fibLevel2
Risk to Reward Ratiofloat2.0riskReward
SMA Length for Trend Filterint200smaLength
ATR Lengthint14atrLength
Fibonacci Lookback Periodint50lookbackPeriod
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

257 stars

This overlay strategy is built for ES futures on the one-minute chart. It plots a volume-weighted moving average of price opens and standard-deviation bands at Fibonacci ratios, plus a second longer volume-weighted average from a higher-timeframe open. Call an

Strategy v5 Volatility & bandsMoving averages
Updated 6 weeks ago · None stated GitHub repository of ES Futures 1M No Repaint

Nasdaq Prop Firm Strategy

by TradersPost
218 stars

This strategy uses multiple VWAP anchors and a custom Lull indicator to generate buy and sell signals on the Nasdaq price chart. It plots the VWAP trend line and three VWAP anchors with customizable colors and mitigation methods. The Lull indicator produces si

Strategy v6 TrendSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Nasdaq Prop Firm Strategy
106 stars

This overlay strategy plots a two-timeframe Ichimoku setup on the price chart, with Tenkan, Kijun, Chikou, and Kumo from a base higher timeframe and an optional highest-timeframe cloud. It allows two entries in the same direction and uses ATR-based trailing st

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of 2Tier Ichimoku Pyramiding [Takazudo]

This strategy implements a multi-stage trend following system inspired by John W. Seykota. It generates long and short entries when price breaks above or below Donchian channels of specified length. Each entry adds a unit sized to risk a fixed percentage of cu

Strategy v6 TrendVolatility & bands
Updated 11 months ago · None stated GitHub repository of Seykota Alt 29: Multi-Stage Scaling

This strategy enters long or short when eight conditions align over the last two bars. It requires EMA 10 and EMA 55 alignment on the one-hour, four-hour and daily charts, a positive ADX slope, matching monitor direction, and price relative to a 400-bar point

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard ABCBitcoin TradingLatino B002
11 stars

Calculates upper and lower Donchian Channel bands over a customizable lookback length and plots them on the main price chart. At a specified exchange hour, the strategy places a long buy stop order at the upper Donchian Channel level. Unfilled pending orders a

Strategy v6 BreakoutSupport & resistance
Updated 5 months ago · Apache-2.0 GitHub repository of Estrategia Donchian Breakout

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers