SMC Institutional Clean Wave & Structure PROSMC Institutional Clean Wave & Structure PRO
SMC Institutional Clean Wave & Structure PRO is a refined technical analysis indicator engineered to provide institutional order flow insights, precise market structure tracking, and uncluttered visual clarity on both light and dark trading themes. It replaces unnecessary chart noise with clean dynamic trend wave fills, smart consolidation candle color detection, and confirmed structure shifts.
Key Features Overview
1. Dynamic Single Trend Wave & Background Fill
Provides a smooth continuous structural trend wave. Renders vibrant green during bullish expansion phases and solid red during bearish contraction phases with a soft, unobtrusive background fill.
2. Smart Consolidation Candle Engine
Automatically highlights price action state. Bullish candles render in bright green, bearish candles in red, while tight consolidation or inside bar candles dynamically shift to a distinct grayish-white color to quickly highlight market compression.
3. Clean Market Structure Shifts (BOS & CHoCH)
Tracks key market structure breakouts. Identifies initial trend reversals as Change of Character (CHoCH) and structural extensions as Break of Structure (BOS), rendered with centered non-overlapping labels.
4. Confirmed Major Swing BUY & SELL Badges
Highlights major institutional high and low pivots with confirmed BUY and SELL badges. Pivot sensitivity and badge styling can be customized independently.
5. Target Standard Deviation Level (-2.5 SD)
Calculates real-time structural volatility and projects a dynamic -2.5 Standard Deviation Target line to help anticipate key potential market reaction levels.
Settings Overview
Trend Wave Settings
- Show Trend Wave Line: Toggle wave line and fill display.
- Colors & Opacity: Adjust trend line colors and background opacity.
Candle Engine Settings
- Enable Smart Candle Color Engine: Toggle adaptive candle colors.
- Custom Colors: Define unique colors for bullish, bearish, and inside bars.
Structure Settings
- Show BOS & CHoCH Shifts: Toggle structure labels.
- Structure Sensitivity: Fine-tune pivot detection rules for cleaner charts.
Signal Badges
- Show Confirmed BUY / SELL Badges: Toggle buy and sell markers.
- Signal Swing Sensitivity: Adjust lookback periods for pivot signals.
Standard Deviation Settings
- Show -2.5 SD Target Line: Toggle volatility target line.
- Custom Style: Adjust line thickness, color, and line style options.
Disclaimer
This script is built strictly for educational, analytical, and charting enhancement purposes. It does not offer financial advice or guaranteed trading results. Practice strict risk management.
Wskaźnik

Hybrid Breakout | VCP-Inspired TrendTrend Squeeze Breakout
Trend Squeeze Breakout is a trend-following momentum strategy designed to identify stocks in strong established uptrends that are consolidating into relatively tight trading ranges before attempting a breakout.
The strategy combines a simplified Minervini-style trend template, volatility contraction, volume confirmation, and stop-entry breakout execution. It is designed primarily for swing trading and is intended to participate in strong upward price expansions while filtering out many breakouts occurring in weak or declining trends.
Strategy Explanation
The strategy follows a simple sequence:
Identify a strong uptrend
A long setup requires:
Price above the 50-period SMA
50 SMA above the 150 SMA
150 SMA above the 200 SMA
200 SMA rising
200 SMA continuing to rise over the selected lookback period
50 SMA not declining
This establishes that the stock is already in a structurally bullish environment before considering an entry.
Identify a volatility contraction
The strategy looks for periods where recent price movement has become unusually tight.
It evaluates both:
Recent high-low range
Recent closing-price range
The high-low range is also compared with its historical percentile over the selected lookback period. This allows the strategy to identify relatively quiet consolidation periods rather than relying on a fixed volatility threshold alone.
Confirm volume
When the volume filter is enabled, breakout volume must exceed the moving-average volume baseline by the selected multiplier.
The default requirement is:
Volume > 20-period average volume × 1.2
This is intended to provide additional confirmation that the breakout is supported by meaningful participation.
Enter on a breakout
When the trend, contraction, and volume conditions are satisfied, the strategy places a stop-entry order above the recent high.
The default breakout lookback is 3 bars, allowing the strategy to attempt to enter as price moves through the recent consolidation high rather than simply buying while the stock remains inside the range.
Manage the position
Positions use tiered profit-taking:
25% closed at +10%
50% closed at +20%
Remaining position closed at +30%
Default stop loss at -8%
This allows the strategy to realize some profits during the initial move while maintaining exposure to larger momentum extensions.
Features
Trend Filter — 50/150/200 SMA bullish alignment
Long-Term Trend Confirmation — Requires the 200 SMA to be rising
Volatility Squeeze Detection — Identifies unusually tight recent ranges
Range Percentile Filter — Compares current volatility with historical volatility
Close-Range Filter — Detects tight price consolidation
Volume Confirmation — Optional volume expansion requirement
Stop-Entry Breakout — Enters only when price breaks the recent high
Tiered Profit Taking — Three configurable profit targets
Percentage-Based Stop Loss — Adjustable downside protection
Date Filter — Allows users to restrict backtests to a specific period
Configurable Parameters — Trend, volatility, volume, breakout, and risk settings can all be adjusted
Tips for Use
Use on liquid stocks
The strategy is generally better suited to liquid stocks and ETFs with sufficient trading volume. Extremely illiquid securities can produce unrealistic backtest results because of spreads and execution differences.
Start with daily charts
The strategy is particularly suited to identifying multi-day or multi-week momentum breakouts. Daily charts are a good starting point when evaluating the strategy.
Avoid optimizing every parameter
The many adjustable parameters make it possible to overfit the strategy to a particular stock or historical period. Test parameter changes across multiple securities and different market environments rather than optimizing exclusively for one chart.
Treat the volume filter as confirmation, not a guarantee
High volume can strengthen a breakout signal, but it does not guarantee that the breakout will succeed.
Test across different market conditions
Trend-following breakout systems typically perform differently during strong bull markets, corrections, sideways markets, and high-volatility periods. Evaluate results across multiple market regimes before relying on the strategy.
Pay attention to execution
The strategy uses stop-entry orders above recent highs. In live trading, gaps, slippage, spreads, and intrabar price movement can cause actual execution prices to differ from backtested results.
Important Note
This strategy is inspired by trend-template and volatility-contraction concepts, but it is not a complete implementation of a textbook VCP. It uses a simplified statistical contraction model rather than explicitly identifying multiple successive contractions, contraction depths, and their associated volume characteristics.
Backtest results are hypothetical and do not guarantee future performance. Always consider commissions, slippage, liquidity, position sizing, and market conditions when evaluating a strategy.
Recommended starting configuration: Daily timeframe, liquid stocks, default trend filter, volume confirmation enabled, and the default tiered risk-management settings.
Strategia

DNSE VN301!, SMA 34/89 Dual Slope Strategy "SMA 34/89 Dual Slope Trend Following" is a trend-following strategy designed to capture sustained directional price movements by identifying alignment between short-term and medium-term trend momentum. The strategy uses SMA(34) and SMA(89), generating Long signals when both moving averages are rising and Short signals when both are falling.
By requiring both SMA slopes to confirm the same direction, the strategy seeks to filter out weaker signals and avoid trades when short- and medium-term trends are not aligned. An optional SMA(200) trend filter provides an additional layer of broader trend confirmation. The strategy also includes configurable stop loss, take profit, trading session filters, and automatic end-of-session position closure for disciplined risk management.
Strategy settings and configuration:
Chart timeframe: recommended 2-minute chart
Position size: 3 contracts
Fast SMA length: 34
Slow SMA length: 89
SMA trend filter: disabled by default
Trend filter SMA length: 200
Stop loss: 10 points
Take profit: 20 points
Take profit: On / Off
Time filter: On / Off
Trading session: 09:00 – 14:30
Trade direction: Long / Short / Both
Signal arrows: disabled by default
Default script settings:
The strategy uses two main SMA lines: SMA(34) and SMA(89). SMA(34) reflects the short-term trend. SMA(89) represents the medium-term trend.
Unlike a traditional SMA crossover strategy, CNPS 03 does not wait for the two SMA lines to cross. Instead, the bot evaluates the slope of each SMA line to identify trend direction.
When SMA(34) is rising and SMA(89) is also rising, the bot confirms an uptrend. When SMA(34) is falling and SMA(89) is also falling, the bot confirms a downtrend.
The SMA(200) trend filter is disabled by default. This is because SMA(89) already acts as a medium-term trend component in the strategy. Users can still enable SMA(200) if they want a stricter trend filter.
When the SMA(200) trend filter is enabled, the script only allows Long trades when SMA(200) is rising and only allows Short trades when SMA(200) is falling.
Entry and exit rules:
Long entry:
SMA(34) is rising
AND SMA(89) is rising
AND SMA(200) is rising, if the SMA trend filter is enabled
AND the signal appears during the trading session
AND trade direction allows Long entries
Long exit:
Stop loss: 10 points from entry price
Take profit: 20 points from entry price, if enabled
Reversal when a valid Short signal appears
Close position when the SMA trend filter turns downward, if the SMA trend filter is enabled
Automatic position close at the end of the trading session
Short entry:
SMA(34) is falling
AND SMA(89) is falling
AND SMA(200) is falling, if the SMA trend filter is enabled
AND the signal appears during the trading session
AND trade direction allows Short entries
Short exit:
Stop loss: 10 points from entry price
Take profit: 20 points from entry price, if enabled
Reversal when a valid Long signal appears
Close position when the SMA trend filter turns upward, if the SMA trend filter is enabled
Automatic position close at the end of the trading session
Strategy logic:
CNPS 03 is suitable for market phases with clear trend direction. When both the fast SMA and the slow SMA are pointing in the same direction, the bot prioritizes trading in that direction.
This design allows the bot to react earlier than a traditional SMA crossover strategy. However, during sideways market conditions, the SMA slopes may change frequently. Users should test the strategy carefully before applying it to live trading.
Time filter:
The default trading session is 09:00 – 14:30, designed to avoid two abnormal volatility periods.
ATO 08:45 – 09:00 is the opening auction period. Price can gap strongly and technical signals may be noisy.
ATC and negotiated trading 14:30 – 15:00 is the closing auction period. Price can move sharply or reverse quickly.
Users can adjust the start time and end time in the bot settings.
Risk disclaimer:
Futures trading involves a high level of risk and prices can move sharply. This script is provided for reference, research, and backtesting purposes only. Users should fully understand derivatives trading, their own risk tolerance, and the strategy logic before applying it to live trading.
All investment decisions are the responsibility of the user. phaisinh.online is not responsible for any losses arising from the use of this strategy in real trading. Past performance does not guarantee future results.
__________________________________________________________
"SMA 34/89 Dual Slope Trend Following" là một chiến lược giao dịch theo xu hướng, được thiết kế nhằm nắm bắt các chuyển động giá có xu hướng kéo dài bằng cách xác định sự đồng thuận giữa xu hướng ngắn hạn và trung hạn. Chiến lược sử dụng SMA(34) và SMA(89), tạo tín hiệu Long khi cả hai đường trung bình động đều dốc lên và tín hiệu Short khi cả hai đều dốc xuống.
Bằng cách yêu cầu độ dốc của cả hai đường SMA xác nhận cùng một hướng, chiến lược hướng tới việc lọc các tín hiệu yếu và hạn chế giao dịch khi xu hướng ngắn hạn và trung hạn chưa đồng thuận. Bộ lọc xu hướng SMA(200) tùy chọn cung cấp thêm một lớp xác nhận xu hướng tổng thể. Chiến lược cũng bao gồm các tùy chọn Stop Loss, Take Profit, bộ lọc khung thời gian giao dịch và cơ chế tự động đóng vị thế khi kết thúc phiên, nhằm đảm bảo quản trị rủi ro một cách chặt chẽ và có kỷ luật.
Cài đặt & cấu hình chiến lược:
Biểu đồ: khuyến nghị khung 2 phút
Khối lượng giao dịch: 3 hợp đồng
Chu kỳ SMA nhanh: 34
Chu kỳ SMA chậm: 89
Bộ lọc xu hướng SMA: Tắt mặc định
Chu kỳ SMA bộ lọc: 200
Cắt lỗ: 10 điểm
Chốt lời: 20 điểm
Dùng chốt lời: Bật / Tắt
Bộ lọc giờ: Bật / Tắt
Khung giờ giao dịch: 09:00 – 14:30
Chiều giao dịch: Mua / Bán / Cả hai
Hiện mũi tên tín hiệu: Tắt mặc định
Cài đặt mặc định của script:
Chiến lược sử dụng hai đường SMA chính là SMA(34) và SMA(89). SMA(34) phản ánh xu hướng ngắn hạn. SMA(89) đại diện cho xu hướng trung hạn.
Khác với chiến lược giao cắt SMA thông thường, CNPS 03 không chờ hai đường SMA cắt nhau. Bot đánh giá độ dốc của từng đường SMA để xác định xu hướng.
Khi SMA(34) dốc lên và SMA(89) cũng dốc lên, bot xác nhận xu hướng tăng. Khi SMA(34) dốc xuống và SMA(89) cũng dốc xuống, bot xác nhận xu hướng giảm.
Bộ lọc xu hướng SMA(200) được để tắt mặc định. Lý do là SMA(89) đã đóng vai trò lọc xu hướng trung hạn trong chiến lược. Người dùng vẫn có thể bật thêm SMA(200) nếu muốn lọc xu hướng chặt hơn.
Khi bật bộ lọc SMA(200), script chỉ cho phép lệnh Mua khi SMA(200) dốc lên và chỉ cho phép lệnh Bán khi SMA(200) dốc xuống.
Điều kiện vào và thoát lệnh:
Vào lệnh Mua:
SMA(34) dốc lên
VÀ SMA(89) dốc lên
VÀ SMA(200) dốc lên, nếu bật bộ lọc xu hướng SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Mua
Thoát lệnh Mua:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
Đảo chiều khi xuất hiện tín hiệu Bán hợp lệ
Đóng lệnh khi SMA bộ lọc đảo chiều xuống, nếu bật bộ lọc xu hướng SMA
Tự động đóng lệnh khi hết khung giờ giao dịch
Vào lệnh Bán:
SMA(34) dốc xuống
VÀ SMA(89) dốc xuống
VÀ SMA(200) dốc xuống, nếu bật bộ lọc xu hướng SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Bán
Thoát lệnh Bán:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
Đảo chiều khi xuất hiện tín hiệu Mua hợp lệ
Đóng lệnh khi SMA bộ lọc đảo chiều lên, nếu bật bộ lọc xu hướng SMA
Tự động đóng lệnh khi hết khung giờ giao dịch
Logic chiến lược:
CNPS 03 phù hợp với các giai đoạn thị trường có xu hướng rõ ràng. Khi cả SMA nhanh và SMA chậm cùng nghiêng về một hướng, bot ưu tiên giao dịch theo hướng đó.
Thiết kế này giúp bot phản ứng sớm hơn so với chiến lược chờ giao cắt SMA truyền thống. Tuy nhiên, trong giai đoạn thị trường đi ngang, hai đường SMA có thể đổi độ dốc liên tục. Vì vậy, người dùng nên kiểm thử kỹ trước khi sử dụng thực tế.
Bộ lọc giờ:
Mặc định 09:00 – 14:30, nhằm tránh hai vùng biến động bất thường.
ATO 08:45 – 09:00 là giai đoạn khớp lệnh mở cửa. Giá thường có thể gap mạnh và tín hiệu kỹ thuật dễ bị nhiễu.
ATC và giao dịch thỏa thuận 14:30 – 15:00 là giai đoạn khớp lệnh đóng cửa. Giá có thể biến động mạnh hoặc đảo chiều nhanh.
Người dùng có thể điều chỉnh giờ bắt đầu và giờ kết thúc trong phần cài đặt bot.
Tuyên bố rủi ro:
Giao dịch hợp đồng tương lai có mức độ rủi ro cao và giá có thể biến động mạnh. Script này chỉ phục vụ mục đích tham khảo, nghiên cứu và kiểm thử. Người dùng cần hiểu rõ giao dịch phái sinh, khẩu vị rủi ro cá nhân và logic của chiến lược trước khi áp dụng vào giao dịch thực tế.
Mọi quyết định đầu tư thuộc trách nhiệm của người dùng. phaisinh.online không chịu trách nhiệm cho bất kỳ khoản lỗ nào phát sinh từ việc sử dụng chiến lược này trong giao dịch thực tế. Hiệu quả trong quá khứ không đảm bảo kết quả trong tương lai.
Strategia

SMA 10/20 Cross & TrailTwo SMAs with crossover and trail-break signals, plus ATR context that tells you whether a signal is a real trend turn or just two lines grinding together.
Most 10/20 moving-average tools give you a cross and nothing else. The
problem is that a cross tells you a regime already changed — by then price
has been below the fast MA for a while — and it gives you no way to tell a
decisive turn apart from two lines chopping around each other in a range.
This script addresses both.
WHAT IT PLOTS
- Two configurable MAs (default SMA 10 and SMA 20; SMA/EMA/WMA/RMA available)
- Shaded fill between them, tinted by which side the fast MA is on, so
regime state is readable at a glance without hunting for the last marker
- Cross markers when the fast MA crosses the slow MA
- Trail-break markers when PRICE closes through either MA — the earlier
warning, and the signal that actually matches how a moving average gets
used as a trailing stop. X = fast MA, circle = slow MA.
- A corner table showing current MA separation in ATR, the regime state
(ENTANGLED / SEPARATING / TRENDING), the strength of the last completed
leg, and where price sits relative to each MA in ATR terms
THE ATR LAYER
Every cross is labelled with how far apart the MAs got during the leg that
just ended, measured in ATR. A cross printing 1.20x means the averages
genuinely separated and have now reversed. A cross printing 0.15x means they
never separated at all and you are looking at noise. Same marker either way —
the number is what tells them apart. Thresholds are user-configurable.
NO REPAINTING
"Confirm on bar close" is on by default: a signal must survive to the bar's
close before it counts, so live and historical markers agree. Turn it off
only if you want intrabar triggers and accept that a signal can disappear.
ALERTS
Seven named conditions — bullish cross, bearish cross, either cross, and
close above/below each MA. Optional rich alert() mode embeds the live ATR
numbers in the message text.
USAGE NOTES
The right setting depends on hold length and volatility, not asset class.
For low-beta instruments and longer holds, use the slow-MA trail and treat
the crosses as primary. For high-beta names and short holds, use the fast-MA
trail and expect the crosses to arrive late. Save each as an indicator
template rather than maintaining two copies of the script.
No external symbols or request.security() calls — it reads the chart symbol
only. Wskaźnik

DNSE VN301!, Bollinger Bands Break Out Strategy "Bollinger Bands Breakout with SMA Trend Filter" is a volatility breakout strategy designed to capture strong directional price movements when price breaks outside its recent trading range. The strategy uses Bollinger Bands, constructed from an SMA(20) and two standard deviations, to identify bullish breakouts when price closes above the upper band and bearish breakouts when price closes below the lower band.
To improve signal quality, the strategy incorporates an optional SMA(200) trend filter, allowing Long trades only when the SMA is rising and Short trades only when it is falling. By combining volatility-based breakout signals with long-term trend confirmation, the strategy seeks to reduce false breakouts during ranging markets while participating in sustained intraday trends. It also includes configurable stop loss, take profit, trading session filters, automatic end-of-day position closure, and trend reversal exits for disciplined risk management.
Strategy settings and configuration:
Chart timeframe: recommended 5-minute chart
Position size: 3 contracts
Bollinger Bands length: 20
Bollinger Bands multiplier: 2.0
SMA length: 200
Stop loss: 10 points
Take profit: disabled
SMA trend filter: On / Off
Take profit: On / Off
Time filter: On / Off
Trading session: 09:00 – 14:30
Trade direction: Long / Short / Both
Default script settings:
The strategy calculates Bollinger Bands using the SMA(20) of the closing price. The upper and lower bands are created by adding or subtracting two standard deviations around the middle line.
When volatility increases, the Bollinger Bands expand. When the market is quiet or moving sideways, the bands contract.
When the closing price breaks above the upper Bollinger Band, buying pressure may be taking control. When the closing price breaks below the lower Bollinger Band, selling pressure may be taking control.
When the SMA(200) trend filter is enabled, the script only allows Long trades when SMA(200) is rising and only allows Short trades when SMA(200) is falling. When the SMA filter is disabled, the strategy can trade both directions based only on Bollinger Bands breakout signals.
Users can add the built-in Bollinger Bands indicator on TradingView with Length 20 and Multiplier 2.0 to visually monitor the signal on the price chart.
Entry and exit rules:
Long entry:
Closing price > upper Bollinger Band
AND SMA(200) is rising, if the SMA filter is enabled
AND the signal appears during the trading session
AND trade direction allows Long entries
Long exit:
Stop loss: 10 points from entry price
Take profit: disabled by default
Closing price touches or breaks below the lower Bollinger Band
SMA(200) turns downward, if the SMA filter is enabled
Reversal when a valid Short signal appears
Automatic position close at the end of the trading session
Short entry:
Closing price < lower Bollinger Band
AND SMA(200) is falling, if the SMA filter is enabled
AND the signal appears during the trading session
AND trade direction allows Short entries
Short exit:
Stop loss: 10 points from entry price
Take profit: disabled by default
Closing price touches or breaks above the upper Bollinger Band
SMA(200) turns upward, if the SMA filter is enabled
Reversal when a valid Long signal appears
Automatic position close at the end of the trading session
Risk disclaimer:
Futures trading involves a high level of risk and prices can move sharply. This script is provided for reference, research, and backtesting purposes only. Users should fully understand derivatives trading, their own risk tolerance, and the strategy logic before applying it to live trading.
All investment decisions are the responsibility of the user. phaisinh.online is not responsible for any losses arising from the use of this strategy in real trading. Past performance does not guarantee future results.
____________________________________________________________________
"Bollinger Bands Breakout với Bộ lọc Xu hướng SMA" là một chiến lược giao dịch theo xu hướng dựa trên sự bứt phá của biến động giá, được thiết kế nhằm nắm bắt các chuyển động mạnh theo một hướng khi giá vượt ra khỏi vùng dao động gần nhất. Chiến lược sử dụng Bollinger Bands, được xây dựng từ SMA(20) và 2 độ lệch chuẩn, để xác định tín hiệu mua khi giá đóng cửa vượt lên trên dải trên và tín hiệu bán khi giá đóng cửa xuống dưới dải dưới.
Để nâng cao chất lượng tín hiệu, chiến lược tích hợp bộ lọc xu hướng SMA(200) (có thể bật hoặc tắt), chỉ cho phép mở vị thế Long khi SMA đang dốc lên và vị thế Short khi SMA đang dốc xuống. Bằng cách kết hợp tín hiệu bứt phá theo biến động của Bollinger Bands với xác nhận xu hướng dài hạn, chiến lược hướng tới việc giảm thiểu các tín hiệu phá vỡ giả trong giai đoạn thị trường đi ngang, đồng thời tận dụng các xu hướng intraday kéo dài. Ngoài ra, chiến lược còn bao gồm các tùy chọn Stop Loss, Take Profit, bộ lọc khung thời gian giao dịch, cơ chế tự động đóng toàn bộ vị thế khi kết thúc phiên, cùng với điều kiện thoát lệnh khi xu hướng SMA đảo chiều, nhằm đảm bảo quản trị rủi ro một cách chặt chẽ và có kỷ luật.
Cài đặt & cấu hình chiến lược:
Biểu đồ: khuyến nghị khung 5 phút
Khối lượng giao dịch: 3 hợp đồng
Chu kỳ Bollinger Bands: 20
Hệ số nhân Bollinger Bands: 2.0
Chu kỳ SMA: 200
Cắt lỗ: 10 điểm
Chốt lời: tắt
Bộ lọc xu hướng SMA: Bật / Tắt
Dùng chốt lời: Bật / Tắt
Bộ lọc giờ: Bật / Tắt
Khung giờ giao dịch: 09:00 – 14:30
Chiều giao dịch: Mua / Bán / Cả hai
Cài đặt mặc định của script:
Chiến lược tính toán Bollinger Bands dựa trên đường SMA(20) của giá đóng cửa. Dải trên và dải dưới được tạo bằng cách cộng hoặc trừ hai độ lệch chuẩn quanh đường giữa.
Khi biến động tăng mạnh, hai dải Bollinger Bands sẽ mở rộng. Khi thị trường đi ngang hoặc biến động thấp, hai dải sẽ co hẹp lại.
Khi giá đóng cửa vượt lên trên dải trên Bollinger Bands, lực mua có thể đang chiếm ưu thế. Khi giá đóng cửa phá xuống dưới dải dưới Bollinger Bands, lực bán có thể đang chiếm ưu thế.
Khi bật bộ lọc xu hướng SMA(200), script chỉ cho phép lệnh Mua khi SMA(200) dốc lên và chỉ cho phép lệnh Bán khi SMA(200) dốc xuống. Khi tắt bộ lọc SMA, chiến lược có thể giao dịch cả hai chiều chỉ dựa trên tín hiệu breakout của Bollinger Bands.
Người dùng có thể thêm chỉ báo Bollinger Bands có sẵn trên TradingView với tham số Length 20 và Multiplier 2.0 để quan sát tín hiệu trực quan trên biểu đồ giá.
Điều kiện vào và thoát lệnh:
Vào lệnh Mua:
Giá đóng cửa > dải trên Bollinger Bands
VÀ SMA(200) dốc lên, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Mua
Thoát lệnh Mua:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: không dùng theo mặc định
Giá đóng cửa chạm hoặc phá xuống dải dưới Bollinger Bands
SMA(200) đảo chiều xuống, nếu bật bộ lọc SMA
Đảo chiều khi xuất hiện tín hiệu Bán hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Vào lệnh Bán:
Giá đóng cửa < dải dưới Bollinger Bands
VÀ SMA(200) dốc xuống, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Bán
Thoát lệnh Bán:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: không dùng theo mặc định
Giá đóng cửa chạm hoặc phá lên dải trên Bollinger Bands
SMA(200) đảo chiều lên, nếu bật bộ lọc SMA
Đảo chiều khi xuất hiện tín hiệu Mua hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Tuyên bố rủi ro:
Giao dịch hợp đồng tương lai có mức độ rủi ro cao và giá có thể biến động mạnh. Script này chỉ phục vụ mục đích tham khảo, nghiên cứu và kiểm thử. Người dùng cần hiểu rõ giao dịch phái sinh, khẩu vị rủi ro cá nhân và logic của chiến lược trước khi áp dụng vào giao dịch thực tế.
Mọi quyết định đầu tư thuộc trách nhiệm của người dùng. phaisinh.online không chịu trách nhiệm cho bất kỳ khoản lỗ nào phát sinh từ việc sử dụng chiến lược này trong giao dịch thực tế. Hiệu quả trong quá khứ không đảm bảo kết quả trong tương lai.
Strategia

Mean Reversion Half-Life & Spread Tracker [OnlyFibonacci] v3.0Mean Reversion Half-Life & Spread Tracker v3.0
A statistical mean-reversion oscillator for spread analysis — Z-Score normalization, closure-time tracking, confirmed signals, target price projection, and a real-time dashboard. Built in Pine Script v6.
This indicator is for educational and analytical purposes only. It does not constitute investment advice, financial advice, or a trading recommendation. Past signal performance does not guarantee future results. Always do your own research and manage risk responsibly.
---
What does this indicator do?
Mean Reversion Half-Life & Spread Tracker measures how far a price or spread has deviated from its statistical mean using a Z-Score oscillator . Beyond simple overbought/oversold readings, it tracks how long extreme deviations typically take to revert to zero, whether the current deviation is lasting longer than average, where price may revert if Z-Score returns to 0, and the historical success rate of confirmed signals.
Default mode: Asset vs Single Moving Average (Mean Reversion) — the chart symbol is normalized against a configurable SMA.
---
Core Features
Two Operational Modes
Asset vs SMA (default): Analyzes Close / SMA ratio for single-asset mean reversion
Pair Trading : Analyzes chart symbol (Asset A) divided by a secondary symbol (Asset B)
Z-Score Engine
Spread Ratio = Close/SMA or Close/Asset B
Z-Score = (Ratio − Rolling Mean) / Rolling Standard Deviation
Default lookback: 200 bars
EMA(3) smoothing applied to raw Z-Score to reduce whipsaw noise
Threshold Levels
Upper threshold: +2.3 (statistical overbought zone)
Lower threshold: −2.3 (statistical oversold zone)
Center line: 0.0 (equilibrium / mean)
Mean Closure Time
Tracks the average number of bars required for Z-Score to return to 0 after breaching ±2.3
Displays active spread duration in real time
Triggers a Time-Stop WARNING when duration exceeds the historical average
Confirmed Signal Logic
BUY : Smoothed Z-Score crosses above −2.3 and holds beyond the threshold for at least 1 full confirmed bar close (bullish mean reversion)
SELL : Smoothed Z-Score crosses below +2.3 and holds beyond the threshold for at least 1 full confirmed bar close (bearish mean reversion)
EXIT : Z-Score reaches 0, time-stop is triggered, or duration exceeds 2× average closure time
Signal Win Rate (%)
Historical success rate of confirmed signals
Win: Z-Score returns to 0 before exceeding 2× average closure time
Loss: Timeout or time-stop triggered before mean reversion completes
Target Price Level
Estimated chart price where Z-Score would equal 0
MA mode: RatioMean × SMA
Pair mode: RatioMean × Asset B price
Optional dynamic dashed projection line on the main chart while a signal is active
Visual Design (v3.0)
Dynamic gradient Z-Score line (red above 0, green below 0, neon tones at extremes)
Gradient-filled area between Z-Score and the zero line
Soft background glow in extreme zones
Modern dark-theme dashboard table with live status indicators
Built-in Alerts
Upper / Lower Threshold Breach
Time-Stop Warning
Bullish Mean Reversion BUY
Bearish Mean Reversion SELL
Signal EXIT
---
Dashboard Table
Live metrics displayed in the top-right corner:
Pair / Mode — active analysis configuration
Current Z-Score — real-time smoothed reading
Target Price Level — estimated Z=0 price
Avg Closure Time — historical mean reversion duration (bars)
Spread Duration — active deviation duration
Time-Stop Status — Normal or Warning
Signal Win Rate (%) — historical confirmed signal success rate
Status indicators: Normal, Active Trade, Warning.
---
How to Use
Add the indicator to your chart (separate oscillator pane).
In default Asset vs SMA mode, set the SMA length (default: 50).
For pair analysis, switch to Pair Trading mode and select Asset B.
Monitor the Z-Score panel:
Z > +2.3 → spread is statistically extended above mean (potential bearish mean reversion)
Z < −2.3 → spread is statistically extended below mean (potential bullish mean reversion)
Z ≈ 0 → statistical equilibrium
Compare Spread Duration against Avg Closure Time in the dashboard.
If Time-Stop shows WARNING, the deviation may be persisting longer than historically normal — review risk management.
Set alerts for threshold breaches, confirmed signals, and exits.
---
How to Interpret
Mean reversion concept : When price or spread reaches statistical extremes, it tends to revert toward its rolling mean over time.
Z-Score : Measures deviation in standard deviation units. ±2.3 represents a strong statistical extreme.
Avg Closure Time : How long past extreme deviations took to revert to zero. If current duration exceeds this, caution is warranted.
Target Price : A dynamic estimate of where price may revert if Z-Score normalizes — a reference level, not a guaranteed target.
Win Rate : A summary of past confirmed signal outcomes. Not a promise of future performance.
Gradient fill : Visually emphasizes the magnitude and direction of deviation from equilibrium.
Horizontal dashed line on the main chart (if enabled): Projects the estimated price level where Z-Score = 0 while a BUY or SELL signal is active. It updates dynamically and disappears on EXIT or target reached. Disable via Show Target Price Projection Line .
---
Recommended Use Cases
Single-asset mean reversion analysis vs SMA
Crypto, forex, and equity pair spread monitoring
Multi-timeframe confluence checks
Alert-based watchlist monitoring
Time-stop and duration-based risk awareness
---
Customizable Inputs
Mode, Asset B Symbol, MA Length
Z-Score Lookback (200), EMA Smoothing (3)
Upper/Lower Threshold (±2.3)
Signal Confirmation Bars (1–5)
Gradient Area Fill, Background Glow, Target Line, Dashboard
---
Important Notes
Non-repainting security calls: gaps_off, lookahead_off
This is an analysis tool — it does not execute trades automatically
Parameters may require optimization across different markets and timeframes
Win rate and closure time are based on historical data and may differ in live conditions
Always use proper position sizing and risk management
---
Keywords
Mean Reversion, Z-Score, Half-Life, Spread Tracker, Pair Trading, Statistical Arbitrage, Oscillator, SMA, Closure Time, Time-Stop, Pine Script v6, OnlyFibonacci
---
Developed with Pine Script v6. For analysis and education only. Wskaźnik

Wskaźnik

EMA 25/68 BIST30 Futures# EMA 25/68 BIST30 Futures
I developed this strategy to test a straightforward and easy-to-understand moving average system on the 15-minute chart of the BIST30 futures contract.
The system monitors crossovers between EMA 25 and EMA 68. A crossover alone is not sufficient to open a position. For a long setup, the highest price of the crossover candle is recorded. For a short setup, the lowest price of the crossover candle is recorded. The signal is confirmed only if price breaks this level within the following four bars. If confirmation does not occur within four bars, the setup is cancelled.
EMA 160 is used solely as a directional filter. Long positions are opened above EMA 160, while short positions are opened below EMA 160. The purpose of this filter is to avoid taking short- and medium-term moving average crossovers against the broader market trend.
If a position has not been stopped out before the end of the session, it is closed at the close of the 17:45 bar, which corresponds to the 18:00 session price. A new position, including one in the opposite direction, cannot be opened on the same bar in which an existing position is closed.
The strategy has been designed so that different parameter settings can be tested for educational and research purposes. Users can change the EMA lengths, the number of confirmation bars, the directional filter and the trailing stop percentage to examine how these variables affect the number of trades, win rate, profit factor and maximum drawdown.
When evaluating parameter changes, users should not focus solely on the highest net profit. It is also important to examine whether neighbouring parameter values produce similar results and whether performance remains consistent across different market periods.
The code avoids calculation methods that could introduce look-ahead bias. The entire entry bar is not treated as price movement that occurred after the position was opened. The trailing stop is calculated using data from a completed bar and becomes active no earlier than the following bar.
Commission and tax on commission are displayed as separate settings. By default, the strategy assumes a commission rate of 0.020% per order leg and a 5% tax applied to the commission. Together, these produce an effective cost of 0.021% per order leg.
If the commission or tax settings are changed, the effective cost per order leg displayed in the table at the top-right corner of the chart must also be entered under Strategy Settings → Properties → Commission.
The strategy was developed for the XU030D1! symbol on a 15-minute chart. Similar results should not be expected on different markets or timeframes. The data source, continuous contract settings, commission, slippage and Bar Magnifier preferences may all affect backtest results.
This strategy is shared for educational and research purposes only. Past performance does not guarantee similar results in the future and should not be used as the sole basis for making investment decisions.
EMA 25/68 BİST30 VADELİ
Bu stratejiyi BIST30 vadeli kontratın 15 dakikalık grafiğinde, mümkün olduğunca sade ve anlaşılır bir hareketli ortalama sistemi denemek için hazırladım.
Sistem EMA 25 ile EMA 68’in kesişmesini takip ediyor. Kesişim tek başına işlem açmak için yeterli değil. Long tarafta cross mumunun en yüksek, short tarafta ise en düşük fiyatı kaydediliyor. Fiyatın bu seviyeyi sonraki dört bar içinde geçmesi halinde sinyal teyit edilmiş sayılıyor. Dört bar içinde teyit gelmezse aday iptal ediliyor.
EMA 160 yalnızca yön filtresi olarak kullanılıyor. Long işlemler EMA 160’ın üzerinde, short işlemler EMA 160’ın altında açılıyor. Amaç, kısa ve orta vadeli ortalama kesişimlerini daha geniş trendin tersine kullanmamak.
Pozisyon seans sonuna kadar stop olmadıysa 17:45 barının kapanışında, yani 18:00 seans fiyatında kapatılır. Pozisyonun kapandığı bar içinde ters yönde yeni pozisyon açılmaz.
Strateji, eğitim ve araştırma amacıyla farklı parametrelerin sonuçlar üzerindeki etkisini incelemeye uygun olacak şekilde ayarlanabilir hazırlanmıştır. EMA uzunlukları, teyit barı sayısı, yön filtresi ve trailing stop oranı değiştirilerek işlem sayısı, kazanma oranı, kâr faktörü ve maksimum düşüş gibi ölçümlerin nasıl değiştiği karşılaştırılabilir. Parametreler değerlendirilirken yalnızca en yüksek net kâra odaklanmak yerine, komşu değerlerde de benzer sonuçların oluşup oluşmadığı ve farklı dönemlerde performansın korunup korunmadığı ayrıca incelenmelidir.
Kodda geleceği görmeye yol açabilecek hesaplama seçenekleri kullanılmadı. Giriş barının tamamı, pozisyon açıldıktan sonra oluşmuş bir fiyat hareketi gibi kabul edilmez. Trail seviyesi tamamlanan barın verileriyle hesaplanır ve en erken sonraki barda çalışır.
Komisyon ve komisyon vergisi ayarlarda ayrı ayrı gösterilir. Varsayılan olarak bacak başına yüzde 0,020 komisyon ve komisyon üzerinden yüzde 5 vergi kabul edilmiştir. Bu ikisinin efektif bacak maliyeti yüzde 0,021’dir. TradingView’in yerleşik komisyon alanı Pine kodunda dinamik bir inputa bağlanamadığı için bu değer değiştirildiğinde, Strateji Ayarları > Özellikler bölümündeki komisyon oranının da tabloda gösterilen efektif oranla aynı yapılması gerekir.
Strateji XU030D1! üzerinde 15 dakikalık grafik için hazırlanmıştır. Farklı piyasalarda veya zaman aralıklarında aynı sonucu vermesi beklenmemelidir. Bar Magnifier kullanımı, veri kaynağı, sürekli vade ayarları, komisyon ve kayma tercihleri backtest sonuçlarını değiştirebilir.
Bu çalışma eğitim ve araştırma amacıyla paylaşılmıştır. Geçmiş performans gelecekte aynı sonucun alınacağını göstermez ve tek başına yatırım kararı için kullanılmamalıdır.
Strategia

Wskaźnik

DNSE VN301!, MACD Cross Strategy"MACD Trend Following with SMA Trend Filter" is a momentum-based trend-following strategy designed to capture directional market moves as momentum begins to strengthen. The strategy uses the MACD indicator, with its standard parameters of Fast EMA(12), Slow EMA(26), and Signal EMA(9), to identify bullish signals when the MACD line crosses above the signal line and bearish signals when it crosses below.
To improve signal quality, the strategy incorporates an optional SMA(200) trend filter, allowing Long trades only when the SMA is rising and Short trades only when it is falling. By combining MACD momentum crossovers with long-term trend confirmation, the strategy seeks to reduce false signals during sideways market conditions while participating in sustained intraday trends. It also includes configurable stop loss, take profit, trading session filters, and automatic end-of-day position closure for disciplined risk management.
Strategy settings and configuration:
Chart timeframe: recommended 5-minute chart
Position size: 3 contracts
MACD fast length: 12
MACD slow length: 26
MACD signal length: 9
SMA length: 200
Stop loss: 10 points
Take profit: 30 points
SMA trend filter: On / Off
Take profit: On / Off
Time filter: On / Off
Trading session: 09:00 – 14:30
Trade direction: Long / Short / Both
Default script settings:
The strategy uses MACD(12,26,9). The MACD line is calculated from the difference between EMA(12) and EMA(26). The Signal line is the EMA(9) of the MACD line.
When MACD crosses above the Signal line, bullish momentum may be taking control. When MACD crosses below the Signal line, bearish momentum may be taking control.
When the SMA(200) trend filter is enabled, the script only allows Long trades when SMA(200) is rising and only allows Short trades when SMA(200) is falling. When the SMA filter is disabled, the strategy can trade both directions based only on MACD crossover signals.
Users can add the built-in MACD indicator on TradingView with settings 12, 26, 9 and source close to visually monitor the signal below the price chart.
Entry and exit rules:
Long entry:
MACD(12,26,9) crosses above the Signal line
AND SMA(200) is rising, if the SMA filter is enabled
AND the signal appears during the trading session
AND trade direction allows Long entries
Long exit:
Stop loss: 10 points from entry price
Take profit: 30 points from entry price, if enabled
MACD crosses below the Signal line
Reversal when a valid Short signal appears
Automatic position close at the end of the trading session
Short entry:
MACD(12,26,9) crosses below the Signal line
AND SMA(200) is falling, if the SMA filter is enabled
AND the signal appears during the trading session
AND trade direction allows Short entries
Short exit:
Stop loss: 10 points from entry price
Take profit: 30 points from entry price, if enabled
MACD crosses above the Signal line
Reversal when a valid Long signal appears
Automatic position close at the end of the trading session
Risk disclaimer:
Futures trading involves a high level of risk and prices can move sharply. This script is provided for reference, research, and backtesting purposes only. Users should fully understand derivatives trading, their own risk tolerance, and the strategy logic before applying it to live trading.
All investment decisions are the responsibility of the user. phaisinh.online is not responsible for any losses arising from the use of this strategy in real trading. Past performance does not guarantee future results.
___________________________________________________________________
"MACD Trend Following với Bộ lọc Xu hướng SMA" là một chiến lược giao dịch theo xu hướng dựa trên động lượng, được thiết kế nhằm nắm bắt các biến động giá theo một hướng khi động lượng thị trường bắt đầu gia tăng. Chiến lược sử dụng chỉ báo MACD với các tham số tiêu chuẩn gồm Fast EMA(12), Slow EMA(26) và Signal EMA(9) để xác định tín hiệu mua khi đường MACD cắt lên trên đường tín hiệu, và tín hiệu bán khi đường MACD cắt xuống dưới đường tín hiệu.
Để nâng cao chất lượng tín hiệu, chiến lược tích hợp bộ lọc xu hướng SMA(200) (có thể bật hoặc tắt), chỉ cho phép mở vị thế Long khi SMA đang dốc lên và vị thế Short khi SMA đang dốc xuống. Bằng cách kết hợp tín hiệu giao cắt động lượng của MACD với xác nhận xu hướng dài hạn, chiến lược hướng tới việc giảm thiểu các tín hiệu nhiễu trong giai đoạn thị trường đi ngang, đồng thời tận dụng các xu hướng intraday kéo dài. Ngoài ra, chiến lược còn bao gồm các tùy chọn Stop Loss, Take Profit, bộ lọc khung thời gian giao dịch, và cơ chế tự động đóng toàn bộ vị thế khi kết thúc phiên, nhằm đảm bảo quản trị rủi ro một cách chặt chẽ và có kỷ luật.
Cài đặt & cấu hình chiến lược:
Biểu đồ: khuyến nghị khung 5 phút
Khối lượng giao dịch: 3 hợp đồng
Chu kỳ nhanh MACD: 12
Chu kỳ chậm MACD: 26
Chu kỳ tín hiệu MACD: 9
Chu kỳ SMA: 200
Cắt lỗ: 10 điểm
Chốt lời: 30 điểm
Bộ lọc xu hướng SMA: Bật / Tắt
Dùng chốt lời: Bật / Tắt
Bộ lọc giờ: Bật / Tắt
Khung giờ giao dịch: 09:00 – 14:30
Chiều giao dịch: Mua / Bán / Cả hai
Cài đặt mặc định của script:
Chiến lược sử dụng MACD(12,26,9), trong đó đường MACD được tính từ chênh lệch giữa EMA(12) và EMA(26). Đường Signal là EMA(9) của chính đường MACD.
Khi MACD cắt lên đường Signal, động lượng tăng có thể đang chiếm ưu thế. Khi MACD cắt xuống đường Signal, động lượng giảm có thể đang chiếm ưu thế.
Khi bật bộ lọc xu hướng SMA(200), script chỉ cho phép lệnh Mua khi SMA(200) dốc lên và chỉ cho phép lệnh Bán khi SMA(200) dốc xuống. Khi tắt bộ lọc SMA, chiến lược có thể giao dịch cả hai chiều chỉ dựa trên tín hiệu giao cắt MACD.
Người dùng có thể thêm chỉ báo MACD có sẵn trên TradingView với tham số 12, 26, 9 và nguồn close để quan sát tín hiệu trực quan bên dưới biểu đồ giá.
Điều kiện vào và thoát lệnh:
Vào lệnh Mua:
MACD(12,26,9) cắt lên đường Signal
VÀ SMA(200) dốc lên, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Mua
Thoát lệnh Mua:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 30 điểm từ giá vào lệnh, nếu bật
MACD cắt xuống đường Signal
Đảo chiều khi xuất hiện tín hiệu Bán hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Vào lệnh Bán:
MACD(12,26,9) cắt xuống đường Signal
VÀ SMA(200) dốc xuống, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Bán
Thoát lệnh Bán:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 30 điểm từ giá vào lệnh, nếu bật
MACD cắt lên đường Signal
Đảo chiều khi xuất hiện tín hiệu Mua hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Tuyên bố rủi ro:
Giao dịch hợp đồng tương lai có mức độ rủi ro cao và giá có thể biến động mạnh. Script này chỉ phục vụ mục đích tham khảo, nghiên cứu và kiểm thử. Người dùng cần hiểu rõ giao dịch phái sinh, khẩu vị rủi ro cá nhân và logic của chiến lược trước khi áp dụng vào giao dịch thực tế.
Mọi quyết định đầu tư thuộc trách nhiệm của người dùng. phaisinh.online không chịu trách nhiệm cho bất kỳ khoản lỗ nào phát sinh từ việc sử dụng chiến lược này trong giao dịch thực tế. Hiệu quả trong quá khứ không đảm bảo kết quả trong tương lai.
Strategia

Wskaźnik

FXTT MA SuiteA multi-moving average toolkit with four fully independent MAs, each supporting six calculation types.
=== Moving Average Types ===
• EMA (Exponential MA) — Weights recent price more heavily. Faster to react than SMA. Best for active traders.
• SMA (Simple MA) — Equal weight to every bar. Smooth but slower. Best for structural trend identification.
• WMA (Weighted MA) — Linear weighting. Falls between EMA and SMA in responsiveness.
• RMA (RMA / SMMA) — Smoothed MA using Wilder's smoothing method. Less lag than SMA, less noise than EMA.
• VWMA (Volume-Weighted MA) — Weights each bar by its volume. Institutions move markets with volume — this MA follows the money.
• HMA (Hull MA) — Designed to eliminate lag while maintaining smoothness. The fastest, smoothest MA of the six.
=== The Four MAs ===
MA 1 (20 EMA, aqua/purple): Short-term trend and pullback entries. Green when rising, purple when falling.
MA 2 (50 EMA, gold/maroon): Medium-term trend direction. Gold up, maroon down.
MA 3 (100 EMA, gray): Structural trend filter. Above = bullish regime. Below = bearish.
MA 4 (200 EMA, white/red): Long-term trend. Off by default. Enable for the bigger picture.
=== Slope Coloring ===
Every MA changes color based on its direction. Rising = lighter/positive color. Falling = darker/negative color. Flat = static color. You see trend shifts without reading a single value.
=== Cloud Fill ===
Shade the area between any two MAs. When MA 1 is above MA 2 and the cloud is enabled, the area between them fills. Crossovers become instantly visible. Set Between A = "MA 1" and B = "MA 2" for the classic 20/50 crossover cloud.
=== Source Selection ===
Each MA can use any price source: close, open, high, low, hl2, hlc3, ohlc4. Build MAs on the midpoint (hl2) for range-based analysis. Use ohlc4 for a balanced price. Use close for standard trend following.
=== How To Use It ===
1. Enable MA 1 (20 EMA) and MA 2 (50 EMA). Watch the crossovers.
2. Enable the cloud between them for visual crossover alerts.
3. Add MA 3 (100 EMA) for structural context. Above 100 = trend is up. Below = down.
4. When all three MAs align — 20 above 50 above 100 — the trend is confirmed at every timeframe.
5. Enable MA 4 (200 EMA) on higher timeframes for the macro picture.
This free version is for the community. Use it, modify it, build on it.
Open-source. Mozilla Public License 2.0. Wskaźnik

Wskaźnik

DNSE VN301!, Keltner Break Out Strategy"Keltner Channel Breakout with SMA Trend Filter" is a trend-following breakout strategy designed to capture strong directional price movements after volatility expansions. The strategy uses the Keltner Channel, constructed from an EMA(20) and ATR(10), to identify bullish breakouts when price closes above the upper channel and bearish breakouts when price closes below the lower channel.
To improve signal quality, the strategy incorporates an optional SMA(200) trend filter, allowing Long trades only when the SMA is rising and Short trades only when it is falling. By combining volatility-based breakout detection with long-term trend confirmation, the strategy seeks to reduce false signals during ranging markets while participating in sustained intraday trends. It also includes configurable stop loss, take profit, trading session filters, and automatic end-of-day position closure for disciplined risk management.
Strategy settings and configuration:
Chart timeframe: recommended 1-minute chart
Position size: 3 contracts
Keltner EMA length: 20
ATR length: 10
ATR multiplier: 2.0
SMA length: 200
Stop loss: 10 points
Take profit: 20 points
SMA trend filter: On / Off
Take profit: On / Off
Time filter: On / Off
Trading session: 09:00 – 14:30
Trade direction: Long / Short / Both
Default script settings:
The strategy calculates the Keltner Channel using EMA(20) and ATR(10). The upper band is calculated by adding ATR multiplied by 2.0 to EMA(20). The lower band is calculated by subtracting ATR multiplied by 2.0 from EMA(20).
When the closing price breaks above the upper Keltner band, buying pressure may be taking control. When the closing price breaks below the lower Keltner band, selling pressure may be taking control.
When the SMA(200) trend filter is enabled, the script only allows Long trades when SMA(200) is rising and only allows Short trades when SMA(200) is falling. When the SMA filter is disabled, the strategy can trade both directions based only on Keltner Channel breakout signals.
Entry and exit rules:
Long entry:
Closing price > Upper Keltner Channel band
AND SMA(200) is rising, if the SMA filter is enabled
AND the signal appears during the trading session
AND trade direction allows Long entries
Long exit:
Stop loss: 10 points from entry price
Take profit: 20 points from entry price, if enabled
Opposite breakout signal appears
Reversal when a valid Short signal appears
Automatic position close at the end of the trading session
Short entry:
Closing price < Lower Keltner Channel band
AND SMA(200) is falling, if the SMA filter is enabled
AND the signal appears during the trading session
AND trade direction allows Short entries
Short exit:
Stop loss: 10 points from entry price
Take profit: 20 points from entry price, if enabled
Opposite breakout signal appears
Reversal when a valid Long signal appears
Automatic position close at the end of the trading session
Risk disclaimer:
Futures trading involves a high level of risk and prices can move sharply. This script is provided for reference, research, and backtesting purposes only. Users should fully understand derivatives trading, their own risk tolerance, and the strategy logic before applying it to live trading.
All investment decisions are the responsibility of the user. phaisinh.online is not responsible for any losses arising from the use of this strategy in real trading. Past performance does not guarantee future results.
_____________________________________________________________________
"Keltner Channel Breakout với Bộ lọc Xu hướng SMA" là chiến lược giao dịch theo xu hướng (trend-following) được thiết kế để nắm bắt các nhịp biến động mạnh của giá sau khi thị trường mở rộng biên độ dao động. Chiến lược sử dụng Keltner Channel, được xây dựng từ EMA(20) và ATR(10), để xác định tín hiệu bứt phá tăng khi giá đóng cửa vượt lên trên dải trên và tín hiệu bứt phá giảm khi giá đóng cửa xuống dưới dải dưới của kênh.
Để nâng cao chất lượng tín hiệu, chiến lược tích hợp bộ lọc xu hướng SMA(200) (có thể bật/tắt), chỉ cho phép mở vị thế Long khi SMA đang hướng lên và vị thế Short khi SMA đang hướng xuống. Bằng cách kết hợp tín hiệu breakout dựa trên biến động với xác nhận xu hướng dài hạn, chiến lược hướng tới việc giảm các tín hiệu nhiễu trong giai đoạn thị trường đi ngang, đồng thời tận dụng hiệu quả các xu hướng mạnh trong giao dịch trong ngày. Ngoài ra, chiến lược còn hỗ trợ các tính năng quản trị rủi ro như Stop Loss, Take Profit, bộ lọc thời gian giao dịch và tự động đóng vị thế trước khi kết thúc phiên để tránh rủi ro qua đêm.
Cài đặt & cấu hình chiến lược:
Biểu đồ: khuyến nghị khung 1 phút
Khối lượng giao dịch: 3 hợp đồng
Chu kỳ EMA Keltner: 20
Chu kỳ ATR: 10
Hệ số nhân ATR: 2.0
Chu kỳ SMA: 200
Cắt lỗ: 10 điểm
Chốt lời: 20 điểm
Bộ lọc xu hướng SMA: Bật / Tắt
Dùng chốt lời: Bật / Tắt
Bộ lọc giờ: Bật / Tắt
Khung giờ giao dịch: 09:00 – 14:30
Chiều giao dịch: Mua / Bán / Cả hai
Cài đặt mặc định của script:
Chiến lược tính toán Keltner Channel dựa trên đường EMA(20) và độ biến động ATR(10). Dải trên được tính bằng EMA(20) cộng ATR nhân hệ số 2.0. Dải dưới được tính bằng EMA(20) trừ ATR nhân hệ số 2.0.
Khi giá đóng cửa vượt lên trên dải trên Keltner, lực mua có thể đang chiếm ưu thế. Khi giá đóng cửa phá xuống dưới dải dưới Keltner, lực bán có thể đang chiếm ưu thế.
Khi bật bộ lọc xu hướng SMA(200), script chỉ cho phép lệnh Mua khi SMA(200) dốc lên và chỉ cho phép lệnh Bán khi SMA(200) dốc xuống. Khi tắt bộ lọc SMA, chiến lược có thể giao dịch cả hai chiều chỉ dựa trên tín hiệu breakout của Keltner Channel.
Điều kiện vào và thoát lệnh:
Vào lệnh Mua:
Giá đóng cửa > Dải trên Keltner Channel
VÀ SMA(200) dốc lên, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Mua
Thoát lệnh Mua:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
Có tín hiệu breakout ngược chiều
Đảo chiều khi xuất hiện tín hiệu Bán hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Vào lệnh Bán:
Giá đóng cửa < Dải dưới Keltner Channel
VÀ SMA(200) dốc xuống, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Bán
Thoát lệnh Bán:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
Có tín hiệu breakout ngược chiều
Đảo chiều khi xuất hiện tín hiệu Mua hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Tuyên bố rủi ro:
Giao dịch hợp đồng tương lai có mức độ rủi ro cao và giá có thể biến động mạnh. Script này chỉ phục vụ mục đích tham khảo, nghiên cứu và kiểm thử. Người dùng cần hiểu rõ giao dịch phái sinh, khẩu vị rủi ro cá nhân và logic của chiến lược trước khi áp dụng vào giao dịch thực tế.
Mọi quyết định đầu tư thuộc trách nhiệm của người dùng. phaisinh.online không chịu trách nhiệm cho bất kỳ khoản lỗ nào phát sinh từ việc sử dụng chiến lược này trong giao dịch thực tế. Hiệu quả trong quá khứ không đảm bảo kết quả trong tương lai.
Strategia

Multi-Timeframe Moving AveragesMulti-Timeframe Moving Averages (MTF MAs) is an all-in-one moving-average overlay with 16 independently configurable slots: eight calculated on the chart timeframe and eight calculated on user-selected timeframes. It combines local and higher-timeframe structure without requiring multiple indicators or repeated chart changes. Every line can be shown or hidden and assigned its own length, calculation type, and color.
The higher-timeframe averages are calculated inside their requested timeframe. For example, a 20-period one-hour EMA on a five-minute chart is calculated from 20 one-hour observations, not from 20 five-minute observations or by scaling an existing chart-timeframe EMA. This preserves the mathematical meaning of the selected length and timeframe.
Its distinctive feature is the MTF display. Completed intervals show finalized MA levels, while the developing interval is rendered as one horizontal line that grows across the interval and adjusts to the current MTF value. This keeps the active higher-timeframe level clear instead of leaving behind a noisy trail of provisional updates.
MOVING-AVERAGE TYPES
Every chart and MTF slot supports nine calculation types:
- SMA uses equal weighting; EMA and RMA use recursive weighting that emphasizes recent observations.
- WMA applies linear weighting, while HMA combines weighted averages for greater responsiveness.
- VWMA weights price by volume, and LSMA returns the endpoint of a least-squares regression line.
- DEMA and TEMA combine multiple EMA stages to reduce conventional EMA lag.
Each method processes the selected source over the selected length. The methods differ in weighting, smoothness, responsiveness, and potential overshoot; none is inherently best for every instrument or market condition.
HOW THE MTF DISPLAY WORKS
Suppose a one-hour EMA is displayed on a five-minute chart. The value changes while the hour is still forming. Connecting every five-minute snapshot can produce a noisy path that obscures the level currently in effect.
MTF MA uses a two-layer rendering method:
- Completed intervals display the finalized higher-timeframe MA value across the chart bars belonging to that interval.
- The developing interval uses the current, unconfirmed MTF value to draw one horizontal segment from the beginning of the interval to the latest bar.
As new chart bars arrive, the live segment extends horizontally and relocates vertically. Its previous provisional positions are not left behind as a separate path. When the higher-timeframe bar completes, its final level joins the historical display and a new live segment begins.
Optional labels identify each active MTF line by timeframe, length, type, and current value. Labels are placed four chart bars to the right for readability only; this horizontal placement does not represent future data.
WHY TWO MTF CALCULATIONS ARE USED
The script requests each MTF average twice. In simplified Pine Script, the calculation is:
mtf_historical = request.security(
syminfo.tickerid,
selected_timeframe,
ma_type(mtf_source, length, type),
lookahead = barmerge.lookahead_on)
mtf_realtime = request.security(
syminfo.tickerid,
selected_timeframe,
ma_type(mtf_source, length, type),
lookahead = barmerge.lookahead_off)
Placing `ma_type()` inside `request.security()` is important: TradingView evaluates the selected MA from bars in the requested timeframe. The script is not calculating an MA from lower-timeframe bars and then relabeling or rescaling it.
The historical request supplies the finalized value used to draw each completed interval. The realtime request supplies the developing value of the active interval. The script counts how many chart bars have elapsed inside that interval and recreates one horizontal line at the latest realtime value:
bars_into_mtf := ta.change(time(selected_timeframe)) != 0
? 0
: nz(bars_into_mtf ) + 1
line.delete(live_line)
live_line := line.new(
bar_index - bars_into_mtf, mtf_realtime,
bar_index, mtf_realtime)
Both endpoints use the same price, so the live MTF display remains horizontal. Its left endpoint stays at the beginning of the higher-timeframe interval, its right endpoint advances with the chart, and the entire segment moves to the latest developing value. This historical/realtime separation provides a visually clean completed record without sacrificing a responsive current level. The same pattern is applied independently to all eight MTF slots.
HOW TO USE IT
Use Chart Timeframe MAs for averages calculated directly from the current chart bars and MTF MAs for averages calculated from another timeframe. Each slot may be enabled independently. Set its length, type, and color; MTF slots also have individual timeframes and labels. Source is shared by the chart MAs, while MTF Source is shared by the MTF group. Show MTF Historical Lines and Show MTF Labels are master display switches.
The intended use is to select MTF periods equal to or higher than the chart timeframe. This makes it possible, for example, to monitor a one-hour, four-hour, and daily moving-average structure while executing from a lower-timeframe chart.
LIMITATIONS AND REPAINTING
Moving averages are descriptive transformations of past and developing price or volume data. They are not support or resistance guarantees, forecasts, trade signals, or evidence that price must react when a line is reached.
The active horizontal MTF segment is calculated from an unconfirmed higher-timeframe bar. It intentionally moves as that bar develops, and its final value may differ from levels displayed earlier in the interval. The indicator does not preserve that sequence of provisional live values.
Historical MTF segments are retrospective by design. To display a completed higher-timeframe level across its full interval, the script uses lookahead when mapping the finalized value onto the interval's lower-timeframe bars. The historical segment therefore shows where the final level belongs visually, not the sequence of values that was available while that interval developed. Historical price contacts, crosses, or apparent reactions must not be treated as time-causal signals or used for backtesting.
Selecting an MTF period below the chart timeframe returns only limited intrabar information and is not the intended use of this indicator. Results also depend on the chart's source data, session, and candle type. Standard candles are recommended when comparing moving-average values with actual traded prices.
This indicator does not generate alerts or trading entries. Wskaźnik

Wskaźnik

DNSE VN301!, Donchian Break Out Strategy"Donchian Channel Breakout with SMA Trend Filter" is a trend-following breakout strategy designed to capture sustained price movements while filtering out low-probability signals. The Donchian Channel identifies breakouts by tracking the highest high and lowest low over a specified lookback period, generating potential entry signals when price closes outside the recent trading range. Because breakouts during sideways or low-volatility markets often fail, the strategy incorporates a Simple Moving Average (SMA) as a trend filter.
Long signals are prioritized when the SMA is rising, while Short signals are prioritized when the SMA is falling, ensuring trades align with the prevailing market trend. By combining breakout detection with trend confirmation, the strategy aims to reduce false breakouts and improve overall signal quality.
*By default: each VN Futures contract requires VND 30,000,000 of initial margin. The strategy assumes an initial capital of VND 100,000,000, resulting in a fixed position size of 3 contracts for each trading signal.
To better reflect real-market trading conditions, the backtest incorporates a commission of VND 10,000 per contract and a minimum slippage assumption of 3 ticks on every executed trade.
Settings & Strategy Configuration:
Chart: recommended 15-minute timeframe
Donchian Channel Period: 20
SMA Period: 200
Stop Loss: 10 points
Take Profit: 20 points
SMA Trend Filter: On / Off
Use Take Profit: On / Off
Time Filter: On / Off
Trading Session: 09:00 – 14:30
Trade Direction: Long / Short / Both
Default Script Settings:
The strategy calculates the upper and lower bands of the Donchian Channel using the selected lookback period. A breakout above the upper band may indicate buying pressure, while a breakout below the lower band may indicate selling pressure.
When the SMA(200) trend filter is enabled, the script only allows Long entries when SMA(200) is rising and only allows Short entries when SMA(200) is falling. When the SMA filter is disabled, the strategy can trade both directions based only on Donchian Channel breakout signals.
Entry & Exit Conditions:
Entry Long:
Close Price > Upper Donchian Channel
AND SMA(200) is rising, if the SMA filter is enabled
AND the signal appears within the selected trading session
AND Long trading is allowed by the trade direction setting
Exit Long:
Stop Loss: 10 points from entry price
Take Profit: 20 points from entry price, if enabled
Opposite Donchian breakout signal
Position reversal when a valid Short signal appears
Automatic close at the end of the trading session
Entry Short:
Close Price < Lower Donchian Channel
AND SMA(200) is falling, if the SMA filter is enabled
AND the signal appears within the selected trading session
AND Short trading is allowed by the trade direction setting
Exit Short:
Stop Loss: 10 points from entry price
Take Profit: 20 points from entry price, if enabled
Opposite Donchian breakout signal
Position reversal when a valid Long signal appears
Automatic close at the end of the trading session
Disclaimers:
Trading futures contracts carries a high degree of risk, and price movements can be highly volatile. This script is intended as a reference and research tool only. It should be used by individuals who understand futures trading, have assessed their own risk tolerance, and are knowledgeable about the strategy’s logic.
All investment decisions are the sole responsibility of the user. DNSE bears no liability for any potential losses incurred from applying this strategy in real trading. Past performance does not guarantee future results.
______________________________________________________________________
"Chiến lược Breakout Donchian Channel kết hợp bộ lọc xu hướng SMA" là một chiến lược giao dịch theo xu hướng, được thiết kế nhằm tận dụng các đợt bứt phá giá mạnh đồng thời giảm thiểu các tín hiệu nhiễu. Donchian Channel xác định các điểm breakout bằng cách theo dõi mức giá cao nhất và thấp nhất trong một khoảng thời gian xác định, từ đó tạo tín hiệu khi giá đóng cửa vượt ra khỏi vùng dao động gần nhất. Do các tín hiệu breakout trong giai đoạn thị trường đi ngang hoặc biến động thấp thường có xác suất thất bại cao, chiến lược sử dụng thêm đường trung bình động đơn giản (SMA) làm bộ lọc xu hướng.
Khi đường SMA đang dốc lên, chiến lược ưu tiên các tín hiệu Long; ngược lại, khi SMA dốc xuống, chiến lược ưu tiên các tín hiệu Short, giúp các lệnh giao dịch đi cùng xu hướng chính của thị trường. Bằng cách kết hợp tín hiệu breakout với xác nhận xu hướng, chiến lược hướng tới việc giảm các tín hiệu phá vỡ giả và nâng cao chất lượng giao dịch.
*Theo mặc định, mỗi hợp đồng VN Futures yêu cầu ký quỹ ban đầu là 30.000.000 VNĐ. Chiến lược giả định vốn ban đầu là 100.000.000 VNĐ, tương ứng với quy mô vị thế cố định là 3 hợp đồng cho mỗi tín hiệu giao dịch được tạo ra.
Để phản ánh sát hơn điều kiện giao dịch thực tế, kết quả kiểm định (backtest) được giả định với phí giao dịch là 10.000 VNĐ cho mỗi hợp đồng và độ trượt giá (slippage) tối thiểu là 3 bước giá (ticks) đối với mỗi lệnh được khớp.
Cài đặt & cấu hình chiến lược:
Biểu đồ: khuyến nghị khung 15 phút
Chu kỳ Donchian Channel: 20
Chu kỳ SMA: 200
Cắt lỗ: 10 điểm
Chốt lời: 20 điểm
Bộ lọc xu hướng SMA: Bật / Tắt
Dùng chốt lời: Bật / Tắt
Bộ lọc giờ: Bật / Tắt
Khung giờ giao dịch: 09:00 – 14:30
Chiều giao dịch: Mua / Bán / Cả hai
Cài đặt mặc định của script:
Chiến lược tính toán biên trên và biên dưới của Donchian Channel dựa trên chu kỳ được chọn. Khi giá phá lên biên trên, lực mua có thể đang chiếm ưu thế. Khi giá phá xuống biên dưới, lực bán có thể đang chiếm ưu thế.
Khi bật bộ lọc xu hướng SMA(200), script chỉ cho phép lệnh Mua khi SMA(200) dốc lên và chỉ cho phép lệnh Bán khi SMA(200) dốc xuống. Khi tắt bộ lọc SMA, chiến lược có thể giao dịch cả hai chiều chỉ dựa trên tín hiệu breakout của Donchian Channel.
Điều kiện vào và thoát lệnh:
Vào lệnh Mua:
Giá đóng cửa > Biên trên Donchian Channel
VÀ SMA(200) dốc lên, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Mua
Thoát lệnh Mua:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
Có tín hiệu breakout ngược chiều
Đảo chiều khi xuất hiện tín hiệu Bán hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Vào lệnh Bán:
Giá đóng cửa < Biên dưới Donchian Channel
VÀ SMA(200) dốc xuống, nếu bật bộ lọc SMA
VÀ tín hiệu xuất hiện trong khung giờ giao dịch
VÀ chiều giao dịch cho phép lệnh Bán
Thoát lệnh Bán:
Cắt lỗ: 10 điểm từ giá vào lệnh
Chốt lời: 20 điểm từ giá vào lệnh, nếu bật
Có tín hiệu breakout ngược chiều
Đảo chiều khi xuất hiện tín hiệu Mua hợp lệ
Tự động đóng lệnh khi hết khung giờ giao dịch
Tuyên bố rủi ro:
Giao dịch hợp đồng tương lai có mức độ rủi ro cao và giá có thể biến động mạnh. Script này chỉ phục vụ mục đích tham khảo, nghiên cứu và kiểm thử. Người dùng cần hiểu rõ giao dịch phái sinh, khẩu vị rủi ro cá nhân và logic của chiến lược trước khi áp dụng vào giao dịch thực tế.
Mọi quyết định đầu tư thuộc trách nhiệm của người dùng. DNSE không chịu trách nhiệm cho bất kỳ khoản lỗ nào phát sinh từ việc sử dụng chiến lược này trong giao dịch thực tế. Hiệu quả trong quá khứ không đảm bảo kết quả trong tương lai.
Strategia

Wskaźnik

Wskaźnik

Wskaźnik

Wskaźnik

Wskaźnik

Wskaźnik
