LRHS Strategy - BakaraFxThis indicator is designed to identify high-probability market reversal zones by combining liquidity sweeps, market structure shifts, and multi-timeframe confirmation.
Concept Behind the Indicator
Financial markets often move to collect liquidity above previous highs or below previous lows before reversing.
This tool focuses on detecting these liquidity raids and then waits for structural confirmation before highlighting potential reversal areas.
How It Works
1. Liquidity Sweep Detection
The indicator identifies when price takes out recent swing highs or lows, suggesting a stop-hunt or liquidity grab.
2. Structural Shift Confirmation
After the liquidity sweep, the script looks for a change in short-term market structure, indicating that momentum may be shifting in the opposite direction.
3. Multi-Timeframe Filtering
Users can select different timeframes for the liquidity hunt and the confirmation phase, allowing better alignment between higher-timeframe context and lower-timeframe entries.
4. Reversal Zones & Signals
When both liquidity and structure conditions are met, the indicator highlights potential reversal areas on the chart.
Best Use
• Works well on volatile markets (Gold, BTC)
• Designed for traders using liquidity, ICT, and price action concepts
• Can be used for scalping, intraday, or swing trading
Important Note
This tool is not a “buy/sell signal generator”.
It provides context and confirmation, helping traders make more informed decisions.
Disclaimer
This indicator is for educational purposes only.
It does not provide financial advice.
Always use proper risk management.
Candlestick analysis
NQ ICT NY Session ChecklistNQ ICT NY Session Checklist
A manual, on-chart checklist indicator designed to enforce ICT execution rules during the New York session on Nasdaq (NQ). The script displays a step-by-step confirmation panel for higher-timeframe bias, liquidity identification, liquidity sweep, market structure shift, fair value gap entry, and risk/reward validation. It helps prevent early entries, FOMO, and overtrading by clearly indicating when all conditions are met and the trader is ready to execute.
eXquTrading FIB (Auto) V1.2eXquTrading FIB (Auto)
This indicator combines a Cloud-based trend filter, a multi-confirmation oscillator system, and an automatic Fibonacci (single-set) tool into one workflow. The goal is to produce filtered, trend-aligned signals while automatically drawing key Fibonacci levels to track pullbacks and targets visually.
Features
1) Cloud Trend Regime (EMA 144 / EMA 169)
Trend direction is defined by the Cloud:
LONG signals only when price is above the Cloud
SHORT signals only when price is below the Cloud
Cloud coloring reflects the current regime (LONG / SHORT / Neutral).
2) 8X Confirmation System (Scalp)
Signals are generated using multiple confirmations instead of relying on a single indicator.
Default Min Confirmation = 3 (adjustable in settings).
Includes components such as RSI, CCI, MFI, MACD, Stochastic, Momentum, Volume, OBV, etc.
Designed to reduce noise by requiring confluence.
3) FAST Mode (Early Trigger)
FAST mode is included and optional.
Uses strong triggers (e.g., OBV/CCI logic) to catch opportunities earlier, before full confirmation is reached.
Can be tuned to be more aggressive or more conservative.
4) Automatic Fibonacci (Single Set)
Fibonacci levels are automatically created based on the indicator’s internal setup logic.
The Fib set updates dynamically as conditions change.
A right-side label distance is used for better readability.
Fib lines stop at the defined distance (no infinite extension).
5) No Repaint
Signals are generated only on candle close.
No intrabar/early-signal repaint option.
6) Visual Customization
You can toggle Cloud / EMAs / FIB / Labels on or off.
Cloud colors, EMA colors, line widths, and label colors are adjustable.
How to Use
Follow the Cloud regime:
Above Cloud → focus on LONG scenarios
Below Cloud → focus on SHORT scenarios
Use 8X signals for confirmation:
Higher min confirmation = fewer signals, typically higher quality.
FAST mode (optional):
Enable for earlier triggers.
Disable for cleaner, more conservative behavior.
Use Fibonacci levels as a visual guide:
Track pullback zones and potential targets with the auto Fib structure.
Recommended Starting Settings
Min Confirmation: 3
FAST Mode: ON (more aggressive) / OFF (cleaner)
Distance Filter: ON
Impulse Filter: ON
Disclaimer
This indicator is not financial advice. Crypto and leveraged trading involve significant risk. Always apply proper risk management and test settings on demo/backtest before using live.
BTC 5m Cycle Scalper newwwcreate a strategy, which buys low and sell high, with the idea of smart hodl" and taking advantage of the crypto cycles.
I have create a freash strategy which you can editas you wish.
You can check the strategy tester to see if your reation works well and if not impve it forther until you have found a version, hich has the ighest profit to drawdown atio"
Strategy settings:
Make sure the straegyhas at least 2 trades stsrt trading from 2018-01-01 onwards. 0.1% commission. 1 tick slippage.
Avoidng Basic Issues: Tp Paste your latest code into the pine editor click into the text area (middle of the area or at the end of a code line) so you can be sure you have activated the text area before you select all and paste the new code.
ORB Breakout Strategy📊 Overview
📈 Systematic intraday Opening Range Breakout (ORB) strategy
🧭 Designed for index CFDs (e.g. US500)
⏱️ Optimized for 5-minute charts during regular trading hours
🛡️ Strict risk management and position sizing
🚦 Maximum one trade per day
💡 Core Idea
🌅 The market establishes a key price range shortly after the open
🚀 A confirmed breakout from this opening range can signal directional momentum
🎯 The strategy trades only confirmed breakouts with predefined risk
📐 Opening Range Definition
⏰ Opening range is defined between 09:30 and 09:45 (exchange time)
🕯️ Uses the first three 5-minute candles of the session
⬆️ Opening Range High is the highest high of those candles
⬇️ Opening Range Low is the lowest low of those candles
🟢 Long Trade
📊 A 5-minute candle closes above the Opening Range High
🟩 A Fair Value Gap (FVG) exists relative to the candle 10 minutes earlier
🧲 A buy limit order is placed at the Opening Range High
🔴 Short Trade
📉 A 5-minute candle closes below the Opening Range Low
🟥 A Fair Value Gap (FVG) exists relative to the candle 10 minutes earlier
🧲 A sell limit order is placed at the Opening Range Low
🛑 Stop Loss
📉 Long trades use the low of the candle 10 minutes before the breakout
📈 Short trades use the high of the candle 10 minutes before the breakdown
🎯 Take Profit
⚖️ Fixed reward-to-risk ratio of 2:1
📏 Take profit distance equals two times the stop loss distance
💰 Position Sizing
💵 Fixed dollar risk per trade (default: $2,000)
📐 Position size is calculated dynamically based on stop loss distance
🔁 Risk remains consistent across changing volatility conditions
⏳ Trade Management Rules
🚦 Maximum one trade per day, including same-bar entries and exits
🕛 No new entries after 12:00 (exchange time)
⏰ All open positions are closed at 15:50
❌ Pending orders are cancelled after the entry cutoff or at session end
⚙️ Execution & Costs
💸 Commission model can be configured in the strategy settings
🧪 Backtests use TradingView Strategy Tester mechanics
📝 Notes
📚 This is a rules-based trading strategy, not a signal service
🔍 Results depend on instrument, broker feed, spreads, and commissions
🧠 Forward testing is strongly recommended before live trading
⚠️ Disclaimer
📖 This script is provided for educational and research purposes only
🚫 It does not constitute financial advice
🔥 Trading leveraged instruments involves significant risk
CelineTrades ModelOverview
Built in collaboration with CelineTrades whose model is inspired by several concepts discussed by ICT (Inner Circle Trader), this model provides traders with a rules-based framework to identify liquidity sweeps and displacement using Inversion Fair Value Gaps (IFVGs). This indicator automates the visualization of this framework, allowing traders to apply their own discretion, risk management and execution rules within a consistent analytical model.
The model integrates:
Higher Timeframe (HTF) and Intermediate Timeframe (ITF) liquidity levels, in the form of previous highs and lows.
Liquidity sweep validation.
Inversion Fair Value Gaps (IFVGs).
How the Model Works
The CelineTrades Model follows a top-down, conditional workflow. Each stage must occur in sequence for the model to progress.
Previous HTF & ITF Liquidity Levels
The model continuously tracks the previous high and low from a user-defined:
- Higher Timeframe (default: 4h).
- Intermediate Timeframe (default: 15m).
These levels represent external liquidity commonly referenced in ICT-style models.
Liquidity Sweep Detection
A liquidity sweep is registered when price first trades beyond a previous high or low.
Key logic:
- HTF sweeps establish directional bias.
- ITF sweeps are only considered after the corresponding HTF level has been swept.
- Swept levels are visually distinguished from levels which have not been swept.
This sequencing prevents premature execution bias and reinforces contextual alignment amongst multiple timeframes.
Inversion Fair Value Gap (IFVG) Identification
An Inversion Fair Value Gap occurs when price closes through a Fair Value Gap. For instance, a bullish IFVG occurs when price closes above the high of a bearish FVG.
Once valid sweep conditions are met, the model monitors price action for a qualifying IFVG, according to the following filters determined by the trader:
- Minimum IFVG size.
- Minimum SL size. The SL is calculated as the distance between the boundary of the IFVG to the recent swing structure.
- Maximum time for IFVG formation in relation to the Intermediate Timeframe. For example, using a 1m chart, a filter of 10 implies that an IFVG must occur within the the first 10 minutes of the ITF.
The model first displays a developing (potential) IFVG, which becomes confirmed only when price fulfils the above inversion criteria.
Model-Based Trade Opportunity Context
When all model conditions align:
- A confirmed IFVG is plotted.
- A contextual model-based trade opportunity label is displayed.
- Risk-based position sizing is calculated for reference. SL distance is automatically calculated as the distance between the closure of the candle which forms the IFVG and the structure high or low.
Important:
These labels do not represent trade signals or recommendations. They reflect model conditions only. Final execution, confirmation and risk decisions remain entirely with the trader.
How to Use the Indicator
The CelineTrades Model is best used as a conceptual workflow, not a checklist or signal engine.
Suggested Workflow
Add the indicator to your chart and configure your settings:
- Choose your preferred HTF and ITF timeframe alignment.
- Decide on IFVG filtering options.
- Choose your risk-based parameters.
- Adjust visual customization settings to your liking.
Identify HTF liquidity context.
Wait for a valid HTF sweep.
Confirm ITF sweep alignment.
Observe IFVG development.
Apply personal execution rules.
The default settings provided with the indicator are a starting point and may be adjusted based on instrument, session or trading style.
Alerts
The indicator allows traders to schedule alerts once the following model conditions occur:
HTF liquidity sweeps.
ITF liquidity sweeps.
IFVG confirmation.
Alerts are designed for awareness, not automation, and do not imply trade direction or outcome.
Terms & Conditions
By accessing and/or using this indicator, you acknowledge and agree to the following:
This script is provided for educational and informational purposes only.
It does not constitute financial, investment, or trading advice.
No profitability, accuracy, or performance outcomes are guaranteed.
Past behavior illustrated by the model does not predict future results or outcomes.
All trading decisions and risk management are the sole responsibility of the user.
The indicator is provided invite-only and access may be modified or revoked at any time.
First FVG per Session - Big Boss Traders)First FVG per Session - Big Boss Traders)
All persistent variables (fvgTop, fvgBottom, boxes) declared with var at the top.
No assignment to na without var → compiles error-free.
FVG boxes and levels are dark orange.
First FVG per session is drawn and prolonged dynamically.
Background colors per session remain.
ICT First FVG Per Session - Big Boss TradersICT First FVG Per Session like per session FVG Asia FVG london First P FVG and New york first P FVG
Order Blocks ScannerHighlights order blocks with inneficiencies onto the chart, while removing mitigated blocks if price has touched that supply or demand area.
Also by default changes the candle color of the order block origin candle to make it easier to see already mitigated blocks for potential breaker block zones.
ABCD Strategy (v7 Ready)//@version=6
indicator("ABCD Strategy v7 – MTF S/R Filter", overlay=true, max_lines_count=300, max_labels_count=300)
//━━━━━━━━━━━━━━━━━━━━━
// INPUTS
//━━━━━━━━━━━━━━━━━━━━━
pivotLen = input.int(5, "Swing Strength", minval=2)
bcMin = input.float(0.618, "BC Min Fib")
bcMax = input.float(0.786, "BC Max Fib")
cdMin = input.float(1.272, "CD Min Extension")
cdMax = input.float(1.618, "CD Max Extension")
htfTF = input.timeframe("240", "Higher Timeframe (S/R)")
srLookback = input.int(200, "HTF S/R Lookback")
srTolerance = input.float(0.002, "S/R Zone Tolerance (0.2%)")
showSR = input.bool(true, "Show HTF S/R Zones")
showTargets = input.bool(true, "Show Targets")
//━━━━━━━━━━━━━━━━━━━━━
// HIGHER TF SUPPORT / RESISTANCE
//━━━━━━━━━━━━━━━━━━━━━
htfHigh = request.security(syminfo.tickerid, htfTF, ta.highest(high, srLookback))
htfLow = request.security(syminfo.tickerid, htfTF, ta.lowest(low, srLookback))
srHighZoneTop = htfHigh * (1 + srTolerance)
srHighZoneBottom = htfHigh * (1 - srTolerance)
srLowZoneTop = htfLow * (1 + srTolerance)
srLowZoneBottom = htfLow * (1 - srTolerance)
//━━━━━━━━━━━━━━━━━━━━━
// DRAW HTF ZONES
//━━━━━━━━━━━━━━━━━━━━━
if showSR
box.new(bar_index - 5, srHighZoneTop, bar_index + 5, srHighZoneBottom,
bgcolor=color.new(color.red, 85), border_color=color.red)
box.new(bar_index - 5, srLowZoneTop, bar_index + 5, srLowZoneBottom,
bgcolor=color.new(color.green, 85), border_color=color.green)
//━━━━━━━━━━━━━━━━━━━━━
// SWING DETECTION
//━━━━━━━━━━━━━━━━━━━━━
ph = ta.pivothigh(high, pivotLen, pivotLen)
pl = ta.pivotlow(low, pivotLen, pivotLen)
var float A = na
var float B = na
var float C = na
var float D = na
var int Ab = na
var int Bb = na
var int Cb = na
var int Db = na
if not na(pl)
A := B
Ab := Bb
B := C
Bb := Cb
C := low
Cb := bar_index
if not na(ph)
A := B
Ab := Bb
B := C
Bb := Cb
C := high
Cb := bar_index
//━━━━━━━━━━━━━━━━━━━━━
// ABCD LOGIC
//━━━━━━━━━━━━━━━━━━━━━
ab = math.abs(B - A)
bc = math.abs(C - B)
bcFib = bc / ab
validBC = bcFib >= bcMin and bcFib <= bcMax
bull = C > B
cdMinPrice = bull ? C - bc * cdMin : C + bc * cdMin
cdMaxPrice = bull ? C - bc * cdMax : C + bc * cdMax
inDzone = low <= cdMaxPrice and high >= cdMinPrice
//━━━━━━━━━━━━━━━━━━━━━
// MTF STRUCTURE FILTER
//━━━━━━━━━━━━━━━━━━━━━
nearResistance = close <= srHighZoneTop and close >= srHighZoneBottom
nearSupport = close <= srLowZoneTop and close >= srLowZoneBottom
structureOK =
(bull and nearSupport) or
(not bull and nearResistance)
//━━━━━━━━━━━━━━━━━━━━━
// FINAL D CONFIRMATION
//━━━━━━━━━━━━━━━━━━━━━
if validBC and inDzone and structureOK
D := close
Db := bar_index
//━━━━━━━━━━━━━━━━━━━━━
// TARGETS
//━━━━━━━━━━━━━━━━━━━━━
tp1 = bull ? D + math.abs(D - C) * 0.382 : D - math.abs(D - C) * 0.382
tp2 = bull ? D + math.abs(D - C) * 0.618 : D - math.abs(D - C) * 0.618
//━━━━━━━━━━━━━━━━━━━━━
// DRAW PATTERN
//━━━━━━━━━━━━━━━━━━━━━
if not na(D)
line.new(Ab, A, Bb, B, width=2, color=color.blue)
line.new(Bb, B, Cb, C, width=2, color=color.orange)
line.new(Cb, C, Db, D, width=2, color=color.green)
label.new(Db, D, "D (HTF CONFIRMED)", style=label.style_label_down, color=color.yellow)
if showTargets
line.new(Db, tp1, Db + 12, tp1, color=color.green)
line.new(Db, tp2, Db + 12, tp2, color=color.teal)
alertcondition(validBC and inDzone and structureOK,
"ABCD v7 Confirmed",
"ABCD Pattern confirmed at Higher-Timeframe Support/Resistance — wait for price action.")
Gold Futures Prop-Firm Strategy (GC) 1-18-2026Overview
This is a long-only, session-based, multi-regime trading strategy designed specifically for Gold futures (GC / GC1!) on intraday timeframes (typically 5–15 minutes).
The strategy aims to capture high-probability moves during the New York and Asian sessions while avoiding major economic news events and enforcing strict daily risk limits — making it suitable for prop firm challenges (e.g. FTMO, FundedNext, Apex, etc.) that require consistent profitability, limited drawdown, and disciplined risk management.
Core Philosophy
Trade longs only (shorts were removed after analysis showed they were consistently unprofitable)
Different logic depending on session and market regime (trending vs ranging)
Heavy filtering using trend strength (ADX), volume confirmation, EMA alignment, Bollinger Bands, and RSI
Strict position sizing, daily loss cap, per-session trade limits, and news blackout periods
Trailing stop mechanism to let winners run while protecting against reversals
Trading Sessions & Time Windows (Eastern Time)
NY Session: 08:30 – 15:00 ET
NY AM (trend/breakout zone): 08:30 – 11:30 ET
NY PM (mean-reversion zone): 11:30 – 15:00 ET
Asia Session (mean-reversion zone): 18:00 – 02:00 ET
News blackouts: short windows around high-impact releases (CPI/NFP, ISM/Fed, FOMC)
Entry Logic (Long Only)
NY AM – Trend Following & Breakouts (strongest trend filter)
ADX > 30 (strong trend)
Price above 200 EMA (bull regime)
Fast EMA (21) crosses above Slow EMA (55) or breakout above 20-bar high
Volume spike (> 1.4 × 20-period SMA)
Max 2 trades per NY session per day
NY PM & Asia – Mean Reversion
ADX ≤ 30 (ranging market)
Price below lower Bollinger Band (20, 2.0)
RSI < 25 (deep oversold)
No volume filter required here
Max 2 trades per Asia session per day
Risk Management Rules
Position size: Fixed 1–2 contracts (user selectable)
Initial stop: 1.7 × ATR(14) below entry (tightened from original)
Trailing stop:
Activates after price moves +1.0 × ATR in profit
Trails by 1.0 × ATR (locked-in profits aggressively)
Daily loss limit: -$600 (stops all trading for the day once hit)
No trading during defined news windows
Pyramiding disabled (only one position at a time)
No short entries (removed after backtest analysis)
Indicators Used
EMA 21 / 55 / 200 (trend direction & filter)
ATR(14) × 0.85 (volatility base)
ADX(14) threshold 30 (strong trend confirmation)
Bollinger Bands (20, 2.0) for mean-reversion entries
RSI(14) with oversold < 25
Volume spike filter (1.4× SMA) for trend/breakout entries
20-bar highest high / lowest low for breakout detection
Visual Elements on Chart
Fast (blue), Slow (orange), and Filter (red) EMAs
Bollinger Bands (gray, semi-transparent fill)
Background coloring:
Red tint during news blackout periods
Purple tint when daily loss limit is hit
Intended Use Case
Prop trading firm evaluation accounts
Conservative intraday gold trading
Focus on high-quality long setups in trending (NY AM) and mean-reverting (Asia/PM) environments
Goal: positive expectancy with controlled drawdown, suitable for passing drawdown and profit targets
eth-usdc.P 1-hour xingchen fuli eth-usdc.P 1-hour xingchen fuli
Add xingchenfuli168 on Telegram to receive the user manual and the indicator backtesting data record sheet.
BTCUSD 1D Trend Strategy [Gemini]1Dchart
100% of equity per trade
0.1% commission
1 tick slippage
please convert this indicator to a trading strategy as you see fit
find attached the date of the chart and the indicator on BTCUSD 1D chart so you can make a better decision when to buy and sell
avoid forward looking and repainting at all costs.
Don't add tables to the chart
don't ever use line breaks in function calls:
long only
2018-2069
1D chart
100% of
Multi-Data Chart-AnalyticsDynamic Sentiment & Contextual Trend Analysis
Function Description
The Multi-Data Chart-Analytics is a comprehensive market context indicator designed to convert complex technical data into a readable, real-time narrative. Unlike traditional visual-only indicators, this script acts as an on-chart "trading assistant" that evaluates price action, momentum, volatility, and institutional volume simultaneously.
Key Technical Features:
Adaptive Trend Engine: Automatically scales its lookback period based on available historical data (up to 200 periods). This ensures accurate analysis for "young" assets or high timeframes (like BTC on Monthly charts) where standard fixed-length EMAs fail.
Momentum & Feel Tracking: Integrates RSI and DMI (ADX) to determine if the market is overextended (expensive) or undervalued (cheap), and whether the trend has sufficient strength.
Volatility Squeeze Detection: Monitors Bollinger Band width to alert users to "coiling" phases, signaling imminent breakouts.
Institutional Volume Filter: Compares current volume against its 20-period moving average to identify "Smart Money" conviction.
Who is this for?
Discretionary Traders: Who want a quick "second opinion" or sanity check before entering a trade.
Beginners: Who find it difficult to read multiple indicators at once; the terminal translates lines into actionable insights.
Systematic Traders: Who need to maintain awareness of higher-timeframe context without cluttering their main chart window.
How to Use It
Look at the Environment: Start by checking the long-term trend status to ensure you aren't trading against the dominant market force.
Verify Momentum: Check "Market Feel" to avoid buying at exhaustion points (Overbought) or selling at bottoms (Oversold).
Prepare for Breakouts: Keep an eye on the "Volatility" section. If it indicates a "Squeeze," tighten your stops or prepare for a large move.
Confirm with Smart Money: Only trust significant moves if the terminal confirms "Institutional Activity" is present.
Customize: Use the settings menu to adjust the box width, colors, and font size to fit your personal chart layout.
Technical Breakdown (Short Form)
Trend: Adaptive EMA/SMA (max 200).
Momentum: RSI (14) + ADX (14).
Volatility: Bollinger Band Width (20).
Volume: SMA (20) based Volume multiplier.
You might want to use this script in combination with our "Range Indicator Golden Pocket" and "Multi Asset & Multi Timeframe Trend Dashoboard" and the "Risk & Reward Position Planner"
Malaysian SnR StoryLinesA Malaysian SnR StoryLines is an HTF-based (Higher Timeframe) level-drawing indicator that automatically identifies and displays key levels derived from market structure:
🔹 Support
🔹 Resistance
🔹 OCL
As well as their state transitions:
🔹 RBS
🔹 SBR
🔹 QM+ (bullish)
🔹 QM- (bearish)
The goal of this indicator is to visually track the life cycle of levels:
➡️ created → broken → role reversal → invalidated
This helps speed up structure reading and level-based decision-making.
🧩 How does it work?
✅ Levels are always generated from the candle structure of the selected HTF timeframe (e.g., D, W).
✅ When a new HTF candle begins, the indicator creates levels based on patterns found in the closed HTF candles .
Levels are drawn horizontally on the chart, and the labels are aligned to the end of each line (transparent background, shifted).
⚠️ Known limitation:
🔹 If you select a chart timeframe that is too low compared to the HTF, some levels may disappear due to Pine Script/TradingwingView drawing limits.
Feedback and feature ideas are welcome. If you spot an issue, please include the symbol and the timeframes used (chart TF + HTF) so it’s easier to reproduce.
TradeSkull Opening Candle Range BoxThis will give you and extended range box of the opening candle of your choice on what ever timeframe you like
TradeSkull Opening Candle Box range of your choiceopening candle range box....pick your time and you will have the high/low and extended range box that you can edit
TRADE BY RAVINDRA(SCALP)VERSION0.003testing use given setting(k-4,atr12,adx19,20,htf-30 for 60% accuracy, this is back test data .
Wick & Body % with upper wick thresholdA simple indicator to give the sizes of wicks and main body of the last candle as percentage of high - low. No negative figures. If the candle is red, the table will be red and vice versa. Table could be located as per user preference. Upper wick threshold is user defined and will be red beyond the threshold.
MFI/RSI Divergence Lower하단 지표 구성 및 활용법
MFI (Aqua Line): 거래량이 가중된 자금 흐름입니다. 지지선 근처에서 이 선이 저점을 높이면(다이버전스) 강력한 매수 신호입니다.
RSI (Yellow Line): 가격의 상대적 강도입니다. MFI와 함께 움직임을 비교하여 보조적으로 활용합니다.
리페인팅 방지 핵심: offset=-lb_r 설정을 통해, 지표가 확정되는 시점(피벗 완성 시점)에 정확히 신호가 표시되도록 구현했습니다. 이는 과거 백테스트 결과와 실시간 매매 결과가 일치하도록 보장합니다.
실전 응용
지지/저항 필터: 이 지표 단독으로 사용하기보다, 차트 상의 주요 지지선에 가격이 위치했을 때 발생하는 BULL DIV 신호만 골라 매수하면 승률이 극대화됩니다.
손절/익절 최적화: 현재 1.5% 손절, 3% 익절로 설정되어 있습니다. 종목의 변동성(ATR)에 따라 group_risk에서 수치를 조정하며 최적의 수익 곡선을 찾아보십시오.
//@version=6
strategy("Hybrid MFI/RSI Divergence Lower",
overlay=false, // 하단 지표 설정을 위해 false
initial_capital=10000,
default_qty_type=strategy.percent_of_equity,
default_qty_value=10,
commission_type=strategy.commission.percent,
commission_value=0.05,
slippage=1)
// --- ---
group_date = "1. 백테스트 기간"
start_time = input.time(timestamp("2024-01-01 00:00:00"), "시작일", group=group_date)
end_time = input.time(timestamp("2026-12-31 23:59:59"), "종료일", group=group_date)
within_window() => time >= start_time and time <= end_time
group_osc = "2. 오실레이터 설정"
mfi_len = input.int(14, "MFI 기간", group=group_osc)
rsi_len = input.int(14, "RSI 기간", group=group_osc)
ob_level = input.int(80, "과매수 기준", group=group_osc)
os_level = input.int(20, "과매도 기준", group=group_osc)
group_div = "3. 다이버전스 감도"
lb_l = input.int(5, "피벗 왼쪽 범위", group=group_div)
lb_r = input.int(5, "피벗 오른쪽 범위", group=group_div)
group_risk = "4. 리스크 관리"
tp_pct = input.float(3.0, "익절 (%)", step=0.1, group=group_risk) / 100
sl_pct = input.float(1.5, "손절 (%)", step=0.1, group=group_risk) / 100
// --- ---
mfi_val = ta.mfi(close, mfi_len)
rsi_val = ta.rsi(close, rsi_len)
avg_val = (mfi_val + rsi_val) / 2 // MFI와 RSI의 평균값으로 부드러운 흐름 파악
// --- ---
// 저점 피벗 탐지 (MFI 기준)
pl = ta.pivotlow(mfi_val, lb_l, lb_r)
ph = ta.pivothigh(mfi_val, lb_l, lb_r)
// Bullish Divergence (상승 다이버전스)
var float last_pl_mfi = na
var float last_pl_price = na
bool is_bull_div = false
if not na(pl)
last_pl_mfi := mfi_val
last_pl_price := low
// 이전 저점 탐색
float prev_pl_mfi = ta.valuewhen(not na(pl), mfi_val , 1)
float prev_pl_price = ta.valuewhen(not na(pl), low , 1)
if low < prev_pl_price and mfi_val > prev_pl_mfi
is_bull_div := true
// Bearish Divergence (하락 다이버전스)
var float last_ph_mfi = na
var float last_ph_price = na
bool is_bear_div = false
if not na(ph)
last_ph_mfi := mfi_val
last_ph_price := high
float prev_ph_mfi = ta.valuewhen(not na(ph), mfi_val , 1)
float prev_ph_price = ta.valuewhen(not na(ph), high , 1)
if high > prev_ph_price and mfi_val < prev_ph_mfi
is_bear_div := true
// --- ---
if within_window()
if is_bull_div
strategy.entry("Bull", strategy.long, comment="Bull Div")
if is_bear_div
strategy.entry("Bear", strategy.short, comment="Bear Div")
strategy.exit("ExB", "Bull", limit=strategy.position_avg_price * (1 + tp_pct), stop=strategy.position_avg_price * (1 - sl_pct))
strategy.exit("ExS", "Bear", limit=strategy.position_avg_price * (1 - tp_pct), stop=strategy.position_avg_price * (1 + sl_pct))
// --- ---
// 배경 레이아웃
hline(ob_level, "Overbought", color=color.new(color.red, 50), linestyle=hline.style_dashed)
hline(50, "Middle", color=color.new(color.gray, 70))
hline(os_level, "Oversold", color=color.new(color.green, 50), linestyle=hline.style_dashed)
// 메인 지표 플롯
plot(mfi_val, "MFI (Money Flow)", color=color.new(color.aqua, 0), linewidth=2)
plot(rsi_val, "RSI (Momentum)", color=color.new(color.yellow, 50), linewidth=1)
// 다이버전스 발생 시 하단 지표 영역에 선 그리기
plotshape(is_bull_div ? mfi_val : na, "Bull Div Circle", shape.circle, location.absolute, color.green, size=size.tiny, offset=-lb_r)
plotshape(is_bear_div ? mfi_val : na, "Bear Div Circle", shape.circle, location.absolute, color.red, size=size.tiny, offset=-lb_r)
// 과매수/과매도 배경색
fill(hline(ob_level), hline(100), color.new(color.red, 90))
fill(hline(0), hline(os_level), color.new(color.green, 90))






















