PROTECTED SOURCE SCRIPT
Cập nhật TA Darvas Box Test

🎯 Core Logic
1-Darvas Box Breakouts/Breakdowns → Entry when price crosses above the Top Box (long) or below the Bottom Box (short).
2-Trend Filter (MavilimW) → Longs only when price is above MAVW, shorts only when below.
3-Momentum Confirmations → ATR spike and Volume spike must confirm breakout strength.
🛠 Position Sizing (MaTriangle – Martingale by Qty)
1-Starts with Base Qty.
2-On losing trades → step-up size using Qty Multiplier, capped by Max Steps & Max Qty Cap.
3-On winning trades → optional reset back to Base Qty.
⚠️ Martingale sizing can increase drawdowns — use carefully.
⏱ Trade Gating
1-Backtest Window: Only trades between selected From – To dates.
2-Trade Cap: Limit trades Per Day / Per Week / Per Month (auto reset).
3-One Position at a Time (pyramiding = 0).
📉 Exit Rules
1-Protective Stops:
2-Long → Stop at Bottom Box.
3-Short → Stop at Top Box.
Profit Safeguard: If in profit, exit when RVI crosses against trade.
1-No fixed TP → trades ride until Box stop or RVI exit.
🔔 Alerts (Options Workflow)
1-Static Alerts: Fire on confirmed long/short signals (compile-safe).
2-Dynamic Alerts: Send ATM strike info, Qty, and Martingale step.
3-Auto ATM Mapping: BANKNIFTY, NIFTY, FINNIFTY, MIDCPNIFTY detected automatically; fallback to manual step.
⚙️ Suggested Defaults
Darvas Box Length = 5
ATR Len = 14, ATR SMA = 14, Mult = 1.0–1.5
Volume SMA = 20, Mult = 1.5–2.0
Base Qty = 1, Mult = 2.0, Max Steps = 3
Trade Cap = Per Day, 10–30 trades
✅ Works on any symbol/timeframe.
⚠️ High-risk position sizing (Martingale). Backtest thoroughly and use with caution.
1-Darvas Box Breakouts/Breakdowns → Entry when price crosses above the Top Box (long) or below the Bottom Box (short).
2-Trend Filter (MavilimW) → Longs only when price is above MAVW, shorts only when below.
3-Momentum Confirmations → ATR spike and Volume spike must confirm breakout strength.
🛠 Position Sizing (MaTriangle – Martingale by Qty)
1-Starts with Base Qty.
2-On losing trades → step-up size using Qty Multiplier, capped by Max Steps & Max Qty Cap.
3-On winning trades → optional reset back to Base Qty.
⚠️ Martingale sizing can increase drawdowns — use carefully.
⏱ Trade Gating
1-Backtest Window: Only trades between selected From – To dates.
2-Trade Cap: Limit trades Per Day / Per Week / Per Month (auto reset).
3-One Position at a Time (pyramiding = 0).
📉 Exit Rules
1-Protective Stops:
2-Long → Stop at Bottom Box.
3-Short → Stop at Top Box.
Profit Safeguard: If in profit, exit when RVI crosses against trade.
1-No fixed TP → trades ride until Box stop or RVI exit.
🔔 Alerts (Options Workflow)
1-Static Alerts: Fire on confirmed long/short signals (compile-safe).
2-Dynamic Alerts: Send ATM strike info, Qty, and Martingale step.
3-Auto ATM Mapping: BANKNIFTY, NIFTY, FINNIFTY, MIDCPNIFTY detected automatically; fallback to manual step.
⚙️ Suggested Defaults
Darvas Box Length = 5
ATR Len = 14, ATR SMA = 14, Mult = 1.0–1.5
Volume SMA = 20, Mult = 1.5–2.0
Base Qty = 1, Mult = 2.0, Max Steps = 3
Trade Cap = Per Day, 10–30 trades
✅ Works on any symbol/timeframe.
⚠️ High-risk position sizing (Martingale). Backtest thoroughly and use with caution.
Phát hành các Ghi chú
SOME IMPROVEMENT Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.