Strategy · Pine Script v5 · On the chart

FVG Auto-Trader

by DANIELMANZRU

A strategy that detects fair value gaps and trades only those scoring high on a five-point quality check covering gap size, impulse strength versus ATR, candle body ratio and volume.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code444
Settings37inputs
LicenceNone stated
Last update3 months ago12 Jul 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  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

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Optional filters include a 200 EMA trend filter, premium and discount zone, session and trading hours. Entries use limit orders at the gap midpoint or another chosen level, with a stop buffer, a fixed reward-to-risk target, optional breakeven and trailing stop, risk-based sizing, a cap on simultaneous trades and optional end-of-day closing.

Details

Published by

DANIELMANZRU on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

SMC / ICT / price action, Trend

Markets

Any symbol

Timeframes

M15-H1, 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
Min Gap Size (%)float0.06min_gap_pct
Min Impulse (x ATR-14)float1.2impulse_atr
Min Body/Range Ratiofloat0.55body_ratio_min
Volume Confirmationbooltrueuse_volume
Volume Multiplierfloat1.2vol_mult
Min Score to Trade (1-5)int4min_score
EMA Trend Filterbooltrueuse_ema
EMA Lengthint200ema_len
Premium/Discount Zone Filterbooltrueuse_pd
Zone Lookback (bars)int50pd_lookback
Session Filterboolfalseuse_session
Allowed Sessionsession0800-1700sess_input
Show all 37 settings
SettingTypeDefaultVariable
Boost Size on Stacked FVGbooltrueuse_stacked
Stacked Within (bars)int5stacked_bars
Risk Per Trade (%)float1.0risk_pct
R:R Ratiofloat2.5rr_ratio
SL Buffer (%)float0.08sl_buf_pct
Move SL to Breakeven at 1Rbooltrueuse_be
Use Trailing Stopboolfalseuse_trail
Trail Distance (%)float0.5trail_pct
Max Simultaneous Tradesint2max_trades
Entry AtstringEQ (50%)entry_at
Order TypestringLimit Orderentry_mode
Restrict Trading Hoursbooltrueuse_time
Start Hour (0-23)int8hour_start
End Hour (0-23)int20hour_end
Close All Trades at EODbooltrueclose_eod
Close at Hourint21eod_hour
Show FVG Boxesbooltrueshow_boxes
Show Entry/SL/TPbooltrueshow_levels
Show EQ Linebooltrueshow_eq
Bullish Fillcolorcolor.new(#00C896, 80)bull_bg
Bearish Fillcolorcolor.new(#FF4560, 80)bear_bg
Stacked Goldcolorcolor.new(#FFD700, 55)stk_col
Enable PineConnector Alertsboolfalseuse_pc
PineConnector License IDstring12345pc_id
PineConnector Risk %float1.0pc_risk
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

57 stars

This strategy identifies trend reversals through market structure changes (CHoCH) filtered by MACD momentum. It initiates long positions on bullish structure breaks when MACD is positive and above its signal line, and short positions on bearish breaks when MAC

Strategy v6 SMC / ICT / price actionOscillators & momentum Repaints
Updated 1 year ago · Apache-2.0 GitHub repository of Market Structure MACD 4H + Trailing

FilledValueGap A006

by ruckard
13 stars

This strategy enters trades in the opposite direction of filled value gaps, operating under the assumption that price action will resume the primary trend after filling a recent gap. It plots directly on the main price chart and supports MA-based trend filters

Strategy v5 SMC / ICT / price actionTrend
Updated 1 year ago · None stated GitHub repository of FilledValueGap A006
12 stars

This strategy is titled for Bitcoin on the four-hour chart and is set to draw on the price chart. It detects three-candle fair value gaps and inverted gaps, and it defines a check for price near a gap midpoint within a percentage tolerance. An optional filter

Strategy v6 SMC / ICT / price actionTrend
Updated 4 months ago · None stated GitHub repository of BTC 4h FVG/iFVG Automated Strategy

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