Các mẫu biểu đồ
ICT Opening Gap Strategy [Momentum1]Momentum strategy taken off the close of the first candle after the NDOG/NWOG. Built with Gemini.
Morgpy Risk BoxThe Morppy Risk Box is an intraday breakout strategy based on constructing a price box defined between 5:00 AM and 9:30 AM. During this interval, the highest and lowest prices reached by the asset are recorded, forming a reference range.
Once the box period ends, the strategy waits for the first candlestick that breaks and closes outside these limits. This breakout is interpreted as an entry signal:
- Buy (long): if the first candlestick closes above the box's high.
- Sell (short): if the first candlestick closes below the box's low.
The logic includes a filter that ensures only one trade is executed per day, preventing multiple entries in the same direction.
ICT Gap Retest Strategy [Custom Exits]Gap Retest Strategy with customizable exit conditions and two adjustable trade windows. Enters on the candle following a retest and exit of the NDOG/NWOG. Written with Gemini.
ALT FINAL ABCD PRO V62. Key Improvements and Performance Optimization of Version v6
Faster Large-Scale Computation: The v6 engine processes large-scale computations more quickly and minimizes delays that occur when pulling Bitcoin and dominance data simultaneously.
Enhanced Repainting: By using the f_secure_data function to check Bitcoin trends, I eliminated 'future reference errors' at the source, ensuring that backtest returns match actual trading results.
Automation of Risk-Reward (R:R): Utilizing ATR multiples, I configured the stop loss to be short (0.8x) and the take profit to be long (1.5x), allowing for automatic responses to the volatility of altcoins.
3. Supplementary Guide for Trading Altcoins
Meaning of VWAP Sweep: In the crypto market, when the price briefly dips below the VWAP and then recovers, it is interpreted as a signal that institutions are absorbing the stop-loss volumes of retail investors. This indicator captures that moment and helps traders enter at the most favorable price level.
Utilizing the Dominance Filter: An altcoin buying signal occurs only when Bitcoin's dominance is below the moving average. This mechanism ensures trading only in 'tailwind' situations where the flow of funds is directed towards altcoins.
Time Zone Focus: The U.S. session (22:30–01:30), marked in orange, is when global liquidity is at its highest. Outside of this time frame, the reliability of patterns decreases, so it is recommended to refrain from trading as much as possible.
Breakout Modewww.youtube.com
======中文===========
策略源于方方土的早盘突破模式,仅限5分钟K线
用前几根K线的高点和低点作为震荡区间,当区间小于平均波动的50%时,突破开盘的震荡区间后,在Measure Move止盈
=======English========
The strategy is derived from Fangfangtu’s opening-range breakout pattern and is limited to the 5-minute timeframe.
The highs and lows of the first few candlesticks are used to define a consolidation range. When the range is less than 50% of the average volatility, a trade is entered upon a breakout of the opening consolidation range, with profit taken using a measured-move target.
ALT FINAL ABCD PRO V6 (ALERT READY)🇺🇸 Strategy Guide: ALT FINAL ABCD PRO V6
1️⃣ Recommended Chart SetupTimeframes: 5m or 15mMarket: Altcoin USDT Perpetual FuturesHigher Timeframe (HTF): 1H (Default)⚠️ Warning: 1-minute charts are NOT recommended due to high market noise.
2️⃣ Strategy OverviewThis strategy trades only high-probability Bull Flag & Bear Flag setups based on BTC trend, BTC Dominance, and EMA 200 positioning.
3️⃣ Trade ConditionsCategoryLONG ConditionsSHORT ConditionsAsset PriceAbove EMA 200Below EMA 200BTC TrendAbove EMA 200 & VWAPBelow EMA 200 & VWAPDominanceBelow its EMA (Alt Season)Above its EMA (Risk-Off)HTF TrendBullish on 1H chartBearish on 1H chartPatternStrong Impulse + Tight ConsolidationStrong Impulse + Tight PullbackLiquidityVWAP Sweep & ReclaimVWAP Rejection from Above
4️⃣ EMA 200 Rule (Critical)Price Above EMA 200: LONG ONLYPrice Below EMA 200: SHORT ONLYPrice Near EMA 200: ❌ No Trade (Indecision zone)
5️⃣ Risk ManagementStop Loss (SL): ATR × 0.8Take Profit (TP): ATR × 1.3Recommended Leverage: Max 3–5xStrict Rules: No averaging down, No counter-trend trades.
MK 1 MIN EMA 9 / EMA 21 CrossoverEMA 9 / EMA 21 Crossover Strategy (1-Minute Scalping)
This strategy is a clean, fast, and reliable EMA crossover system designed specifically for 1-minute intraday scalping.
It uses only EMA 9 and EMA 21, keeping the chart uncluttered while delivering clear BUY and SELL signals based on momentum shifts.
🔹 How It Works
BUY Signal:
When EMA 9 crosses above EMA 21, indicating bullish momentum.
SELL Signal:
When EMA 9 crosses below EMA 21, indicating bearish momentum.
Signals are confirmed visually using:
On-chart BUY / SELL text labels
Dynamic EMA color highlighting
Smart legend (top-right) that remembers the last active signal
🎨 Visual Features
EMA 9 plotted in green (turns bright on bullish trend)
EMA 21 plotted in red
BUY and SELL labels displayed directly on crossover candles
Dynamic legend:
BUY row stays green after bullish cross
SELL row stays red after bearish cross
Makes trend direction instantly clear, even on fast charts
⏱ Best Use
Timeframe: 1-minute
Suitable for:
Index scalping
Options scalping
High-liquidity stocks & ETFs
Works best during high-volume market hours
EMA Crossover with Pine Logs2We are exclusively licensed Austria Guides and count on smaller groups – this is how communication with the guests works best. Exciting facts and a large portion of humour are part of our tours, just like a lot of experience and knowledge off the beaten track. We even infect die-hard Vienna connoisseurs with our enthusiasm for the city! If you want to get to know Vienna differently than the average tourist, then we are your perfect partner: We make sure that your travel stories are nowhere to be found.
Bulkowski Breakout vPRO (5m) - Runtime FixedHere is the English translation of your strategy guide, tailored for international traders while maintaining your encouraging tone.Strategy Guide: Bulkowski Breakout vPROFor Aspiring "Golden Traders"This strategy is designed for beginners to trade with the "flow of power." In short, it is a momentum-following strategy that enters a trade when a strong price move (Long Body Candle + High Volume) breaks through a key psychological level (200 EMA).1. Core Concept: "The High-Energy Breakout"Based on the principles of Thomas Bulkowski, a legendary master of chart patterns, this strategy prioritizes high-energy moves over simple price touches. A signal (LONG or SHORT) is only generated when these three conditions align:200 EMA Break (The Baseline): The 200-period Exponential Moving Average is the "life-line" of the market. Price breaking above this line indicates a powerful shift from a bearish to a bullish trend.Long Body Candle (Volatility): The candle body must be at least 2x larger than the recent average. This serves as evidence of institutional or "whale" buying/selling.Volume Surge (Reliability): Trading volume at the moment of breakout must be 1.5x higher than the recent average. This confirms the move is genuine and not a "fake-out."2. Session Filter (Optimized for Peak Volatility)To avoid "choppy" sideways markets, this strategy only operates during the first two hours of the major global market opens, when liquidity is at its highest.MarketTime (KST / UTC+9)Market CharacteristicsAsia Session09:00 ~ 11:00Opening of Korean, Japanese, and Chinese markets.Europe Session16:00 ~ 18:00Volatility spikes as the London market opens.US Session22:00 ~ 24:00Peak global liquidity as New York opens.Signals only appear when the chart background is shaded blue. All other times are "resting periods" to protect your capital.3. Execution GuideEntryLONG (Buy): Enter when a large green candle breaks above the yellow 200 EMA with high volume. (Green triangle label appears).SHORT (Sell): Enter when a large red candle breaks below the yellow 200 EMA with high volume. (Red triangle label appears).Take Profit (TP) & Stop Loss (SL)Lines are automatically drawn on your chart once you enter:Orange Line (Stop Loss): Automatically set at the low (or high) of the last 3 candles. If the price touches this, the trade closes to prevent further loss.Green Line (Take Profit): Automatically set at 1.5x your risk. This ensures a healthy 1:1.5 Risk-to-Reward ratio.4. Pro-Tips for BeginnersOptimized for 5m: This strategy works best on the 5-minute (5m) timeframe. 1m is often too noisy, and 15m can be too slow for scalping.Watch Bitcoin: Even if an altcoin gives a LONG signal, be cautious if Bitcoin is currently crashing. BTC dictates the overall market direction.Adjusting Sensitivity: If signals are too rare, go to "Settings" and lower the Long Body Multiplier from 2.0 to 1.5.This indicator is built to help you trade based on statistical advantages, not emotions. We strongly recommend practicing with Paper Trading first to get a feel for the signals.To everyone dreaming of becoming a Golden Trader—Success is a marathon, not a sprint!
Uptrick: Price Memory Trend StrategyHere are clear, structured notes explaining the Pine Script code — the simplified "LSTM-like" trend predictor you were given earlier.
Overall Purpose of the Script
The script tries to imitate LSTM memory behavior (long-term memory + selective forgetting/updating) using only Pine Script's basic math and variables — because real LSTM neural networks (with matrices, multiple gates, backpropagation) are not possible in Pine.
It creates a persistent memory line that:
slowly forgets old information,
selectively accepts new price information,
tries to act as a trend-following / regime-detecting centerline.
Then it uses momentum of this memory line + deviation size to decide whether the market is in an uptrend or downtrend.
Key Sections Explained
1. Inputs (tunable parameters)
pinescriptmemoryStrength = input.float(0.14, "Forget Gate strength (like 1-f)", step=0.01, minval=0.01, maxval=0.99)
inputGate = input.float(0.22, "Input Gate strength", step=0.01, minval=0.01, maxval=1.0)
cellDecay = input.float(0.965, "Cell state decay", step=0.001, minval=0.8, maxval=0.999)
lookback = input.int(21, "Lookback for momentum", minval=5)
sensitivity = input.float(1.35, "Trend sensitivity multiplier", step=0.05)
ParameterWhat it controlsTypical effectHigher value means…memoryStrengthHow aggressively old memory is forgottenControls "forget gate" strengthForgets faster, more responsiveinputGateHow much new price is allowed into memoryControls how much price influences cellMemory follows price more closelycellDecayNatural fading of long-term memory per barPrevents memory from living foreverLower = memory fades fasterlookbackPeriod for momentum and deviation calculationSmoothness of trend detectionLonger = smoother, fewer signalssensitivityHow strong momentum must be to flip trendFinal trigger strictnessHigher = fewer but stronger signals
2. Memory Variables (the "LSTM core")
pinescriptvar float cell = na // long-term memory ≈ cell state C
var float hidden = na // short-term state ≈ hidden state h
if bar_index == 0
cell := price
hidden := price
cell → tries to act like LSTM cell state (long memory)
hidden → tries to act like LSTM hidden state (what we actually observe/use)
3. Simplified Gates
pinescriptforget = math.tanh(hidden * memoryStrength)
i_gate = math.tanh(price * inputGate)
candidate = price - hidden
forget — value between -1 and +1, but we treat higher positive = forget more
i_gate — how much new info we want to accept
candidate — the new information we could add (difference from current hidden)
Very crude approximation — real LSTM uses sigmoid + learned weights.
4. Core LSTM-like Update Rule
pinescriptcell := cell * (1 - forget) + candidate * i_gate
cell := cell * cellDecay
hidden := cell * 0.65 + price * 0.35
This is the heart of the "fake LSTM":
Keep (1 – forget) of old cell
Add a portion (i_gate) of the candidate change
Apply slow exponential decay (cellDecay < 1)
Hidden state = mix between long memory and current price
→ base = hidden becomes our smoothed, memory-aware centerline.
5. Trend Detection Logic
pinescriptmom = ta.change(base, lookback) // how much did memory move in last N bars?
dev = math.abs(price - base) // how far is price from memory center?
avgDev = ta.ema(dev, lookback * 2) // smoothed deviation size
trendScore = (mom / avgDev) * sensitivity // normalized momentum × sensitivity
Normalizes momentum by current volatility/deviation
High positive → strong upward memory movement → likely uptrend
High negative → strong downward memory movement → likely downtrend
6. Trend State Machine (non-repainting flip)
pinescriptvar int trend = 0 // 1 = Up, -1 = Down, 0 = Neutral
bullCondition = trendScore > 1.0 and trendScore <= 1.0
bearCondition = trendScore < -1.0 and trendScore >= -1.0
if bullCondition
trend := 1
else if bearCondition
trend := -1
else
trend := nz(trend )
Only changes trend when crossing the threshold from the other side
Prevents flickering / frequent flipping
Persistent until strong opposite signal appears
7. Visualization Summary
Background tint (light green/red)
Thick memory line (changes color with trend)
Dashed ±1.6× deviation bands
Big up/down labels on trend flips
Alert conditions on every new trend direction
Quick Tuning Guide
GoalSuggestionFewer but stronger signals↑ sensitivity (1.6–2.2), ↑ lookback (30–60)More responsive / earlier entries↑ inputGate, ↓ cellDecay, ↓ memoryStrengthSmoother memory line↓ inputGate, ↑ cellDecay (0.98+)Better in choppy markets↑ lookback, ↑ sensitivityBetter in trending markets↓ lookback, moderate sensitivity (~1.2–1.5)
Most Important Takeaway
This is not a real LSTM — it's a hand-crafted, analog-style memory filter inspired by LSTM ideas.
It tries to combine:
slow-adapting memory (like EMA but with forgetting control)
selective update depending on current deviation
momentum-of-memory as trend strength
Many traders find this kind of memory line more "intelligent" than simple moving averages when tuning the forget/input/decay parameters to match the market personality.
London Breakout Optimized PFBest Practices:
Only take trades in trend and above/below VWAP
Avoid trading in low-volume or sideways markets
Use it for intraday 5-min charts (15-min for trend confirmation)
Track trades in a Trading Journal → improves discipline
Entry Rules:
Long (Buy):
Price above EMA21 & VWAP → bullish trend
EMA slope positive → strong trend confirmation
Pullback to entry zone OR breakout above resistance
Volume above 1.3× average → avoids weak moves
Short (Sell):
Price below EMA21 & VWAP → bearish trend
EMA slope negative → strong downtrend
Pullback to entry zone OR breakout below support
Volume above 1.3× average
Exit Rules:
Stop-Loss: ATR-based, dynamic (tight for fewer losses)
Take Profit: Risk × 3 (3:1 R:R)
Automatically handled by the strategy (strategy.exit)
ORBitOrbit is a strategy based around the opening range breakout. it will send out one signal a day with the proper risk management recommendations and built in backtest reporter on top of tradingview's strategy tester
Swing Failure Pattern Strategy Btc Only 5min🔍 Overview
The Swing Failure Pattern (SFP) Strategy is a pure price-action trading system designed to capture liquidity sweeps and market reversals around key swing highs and lows.
It is based on the concept that price often briefly breaks a swing level to trigger stop-losses, then reverses in the opposite direction.
This strategy trades only confirmed SFP setups, ensuring disciplined entries with clearly defined risk.
📈 Bullish SFP (Long Setup)
A Bullish Swing Failure Pattern forms when:
A valid swing low is created
Price wicks below the swing low
The candle closes back above the swing level
Confirmation occurs when price closes above the opposing high
➡️ Action: Enter LONG on the confirmation candle close
📉 Bearish SFP (Short Setup)
A Bearish Swing Failure Pattern forms when:
A valid swing high is created
Price wicks above the swing high
The candle closes back below the swing level
Confirmation occurs when price closes below the opposing low
➡️ Action: Enter SHORT on the confirmation candle close
🛑 Risk Management
Stop Loss
Long → Low of the SFP wick
Short → High of the SFP wick
Take Profit
Fixed Risk : Reward = 1 : 2
All SL and TP levels are fixed at entry (no repainting)
🔁 Trailing Take Profit (Optional)
Trailing TP can be enabled from settings
Trailing starts after 1R profit
Trail distance is R-based and fully adjustable
Works for both long and short trades
⏰ Time Filters
Optional No-Trade on Saturday & Sunday
Prevents new entries during weekends
Active trades continue to manage SL & TP normally
⚙️ Strategy Features
Price-action based (no indicators)
Confirmation-only entries
No repainting logic
Works on all markets and timeframes
Orders executed on candle close
🎯 Best Use Cases
Forex
Indices
Crypto
Futures
Best performance during London & New York sessions
⚠️ Disclaimer
This strategy is intended for educational and backtesting purposes only.
Always test and manage risk appropriately before live trading.
Anhnga4.0 - Filter ToggleINPUTS:
1.5 0.8 (OR 1.6 0.5/0.6)
BE=0.45
1
MAs: 35 135
7
This Pine Script code defines a trading strategy named **"Anhnga4.0 - Filter Toggle"**. It is a trend-following strategy that uses momentum oscillators and moving averages to identify entries, while featuring a specific "Overextension Filter" to avoid buying at the top or selling at the bottom.
Here is a breakdown of how the script works:
---
## 1. Core Trading Logic (The Entry)
The strategy looks for a "perfect storm" of three factors before entering a trade:
* **Momentum (WaveTrend):** It uses the WaveTrend oscillator (`wt1` and `wt2`).
* **Long:** A bullish crossover happens while the oscillator is below the zero line (oversold).
* **Short:** A bearish crossunder happens while the oscillator is above the zero line (overbought).
* **Trend Confirmation:** The price must be on the "correct" side of three different lines: the 20-period Moving Average (BB Basis), the 50-period SMA, and the 200-period SMA.
* **The Window:** You don't have to enter exactly on the cross. The `Signal Window` allows the trade to trigger up to 4 bars after the momentum cross, provided the trend filters align.
## 2. The "Overextension" Filter
This is a unique feature of this script. It calculates the distance between the current price and the **50-period Moving Average**.
* If the price is too far away from the MA (defined by the **ATR Limit**), the script assumes the move is "exhausted."
* If `Enable Overextension Filter?` is on, the strategy will skip these trades to avoid "chasing the pump."
* **Visual Cue:** The chart background turns **purple** when the price is considered overextended.
---
## 3. Risk Management & Exit Strategy
The script manages trades dynamically using Bollinger Bands and Risk:Reward ratios:
| Feature | Description |
| --- | --- |
| **Stop Loss (SL)** | Set at the **Lower Bollinger Band** for Longs and **Upper Band** for Shorts. |
| **Take Profit (TP)** | Calculated based on your **RR Ratio** (default is 2.0). If your risk is $10, it sets the target at $20 profit. |
| **Breakeven** | A "protection" feature. Once the price moves in your favor by a certain amount (the `Breakeven Trigger`), the script moves the Stop Loss to your entry price to ensure a "risk-free" trade. |
---
## 4. Visual Elements on the Chart
* **Green Lines:** Your target price (TP).
* **Red Lines:** Your initial Stop Loss.
* **Yellow Lines:** Indicates the Stop Loss has been moved to **Breakeven**.
* **Purple Background:** High alert—price is overextended; trades are likely being filtered out.
---
## Summary of Settings
* **BB Multiplier:** Controls how wide your initial stop loss is.
* **ATR Limit:** Controls how sensitive the "Overextension" filter is (higher = more trades allowed; lower = stricter filtering).
* **Breakeven Trigger:** Set to 1.0 by default, meaning once you are "1R" (profit equals initial risk) in profit, the stop moves to entry.
DayTradeMind Combined High Win Rate StrategyThe DayTradeMind Combined High Win Rate Strategy is a trend-following system that relies on confluence—the idea that a trade signal is stronger when multiple independent indicators agree. Instead of entering on a single indicator's whim, it uses a "voting" system to qualify entries and a strict risk-to-reward ratio to manage exits.Here is a breakdown of the three main layers of this strategy:1. The Voting Engine (Confluence Model)The strategy tracks four indicators and assigns a "point" for a bullish or bearish bias. It requires a minimum number of points (set by minConfirmations, usually 2/4) before it even considers a trade.IndicatorBullish Condition (1 point)Bearish Condition (1 point)PurposeMACDMACD Line > Signal LineMACD Line < Signal LineMeasures short-term momentum.DonchianPrice > 20-period MedianPrice < 20-period MedianIdentifies price relative to recent range.SuperTrendPrice above trend linePrice below trend lineFilters for the "Macro" trend direction.%B (Bollinger)Price in lower-mid range (0.2–0.5)Price in upper-mid range (0.5–0.8)Prevents buying when overextended.2. The Entry TriggerHaving enough "votes" (confirmations) isn't enough to enter. The strategy waits for a trigger event to ensure you aren't entering a stale trend. An entry only occurs if the minimum confirmations are met AND one of the following happens on the current bar:MACD Cross: The MACD line crosses over the signal line.Structural Break: The price crosses over the Donchian Middle (Median) line.This "Confirmation + Trigger" approach is designed to catch the start of a momentum push rather than buying a flat market.3. Mathematical Risk ManagementThe performance you see in your backtest (like the 46.86% return) is largely driven by the 2:1 Reward-to-Risk (RR) Ratio.Stop Loss (SL): Fixed at 2% below entry.Take Profit (TP): Fixed at 4% above entry.By aiming for a target twice as large as the risk, the strategy can remain profitable even with a win rate as low as 35%–40%. Mathematically, your winning trades compensate for more than two losing trades.Visualizing the SystemTriangles: Small green (up) and red (down) triangles appear on your chart only when the Votes + Trigger align perfectly.Background Shading: Faint green or red bands show you exactly when the "Confluence" is active. If the background is gray, the indicators are in conflict.Dashboard: The table in the top-right summarizes the current "score" for each indicator, letting you know how close you are to a potential trade signal.
High Probability Trend Continuation (1:5 RR)this strategy is based on a high-probability trend continuation pattern, one of the most frequently occurring setups in financial markets. It uses EMA trend alignment to identify strong bullish or bearish conditions and waits for a controlled pullback before entering a trade in the direction of the trend.
Risk management is fully automated using ATR-based stop losses, ensuring the strategy adapts to market volatility. Each trade is executed with a fixed 1:5 risk-to-reward ratio, allowing profitability even with a modest win rate.
The strategy is designed to work across multiple markets and timeframes, including forex, stocks, indices, and crypto, making it suitable for both intraday and swing trading.
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
Axis-Pro System | Trend Structure + Fibonacci Pullbacks Axis-Pro System is a comprehensive Trend Following strategy designed to trade high-probability pullbacks. Unlike indicators that merely chase price, this system patiently waits for market structure alignment before seeking an entry.
The system is built on the premise of "Quality over Quantity", utilizing volatility and structure filters to avoid choppy markets (ranges) and false breakouts.
🧠 Strategy Logic
The system makes decisions based on a strict 4-step hierarchy:
Higher Timeframe (HTF) Bias:
Analyzes the trend on a higher timeframe to ensure we are trading in the direction of the dominant flow.
Structure & BOS (Break of Structure):
Identifies clear impulses that break previous highs or lows. Once a BOS is confirmed, the system "arms" the trade and waits.
Fibonacci Zone Pullback:
It does not chase the breakout. Instead, it waits for a pullback into the "Discount Zone" (Golden Zone, configurable between 0.382 and 0.618) to improve the Risk/Reward ratio.
Validation & Trigger:
Uses an ATR expansion check to filter out low-volatility periods.
Requires candle confirmation and alignment with fast EMAs before pulling the trigger.
🛡️ Risk Management
The system incorporates advanced position management using a split execution model (50/50):
Dynamic Stop Loss: Automatically calculated using an ATR multiplier or the recent Swing High/Low (whichever offers better protection).
TP1 (Take Profit 1): Closes 50% of the position at a fixed R-multiple (e.g., 1.5R) to lock in profit and moves the Stop Loss to Break-Even.
TP2 (Runner): The remaining 50% is left to run for higher targets (e.g., 3.0R) or until the trend bends, maximizing gains during strong moves.
Trailing Stop: Optional feature to trail price with a fast EMA once the first target is hit.
⚙️ Settings & Features
The script is highly customizable for different assets (Crypto, Forex, Indices):
Date Range Filter: Includes a date selector to perform precise Backtesting on specific periods (e.g., testing specifically during a Bear Market vs. Bull Market).
Auto Trendlines: Automatically draws relevant trendlines for visual support.
Quality Filters: Options to toggle the EMA 200 filter and breakout buffers.
⚠️ Disclaimer
This strategy is a tool for analysis and backtesting purposes. Past performance does not guarantee future results. It is highly recommended to test the strategy on a Demo account first and adjust parameters according to the volatility of the specific asset being traded. Always use responsible risk management.
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))






















