OPEN-SOURCE SCRIPT
Cập nhật SmartDCA by TradeAkademi

SmartDCA is a single-direction (Long or Short) step-based DCA strategy with adaptive take-profit and structured risk management.
All core parameters are fully user-configurable. The strategy logic does not enforce a fixed trading style; behavior depends entirely on user-selected settings.
General Structure
The strategy operates in one direction at a time (Long or Short).
All position management logic is applied relative to the selected direction.
The strategy plan is visualized either across the entire chart history or within a user-defined custom backtest date range.
Entry Configuration
Users can select the entry model:
Optional entry filters refine signal selection based on:
DCA & Position Scaling
After initial entry:
This ensures the full theoretical risk is bounded and visible.
Exit Models
Users can choose the exit behavior:
All exits are executed using market orders.
Additional Risk Controls
Optional risk features include:
These mechanisms are configurable and do not override the predefined maximum DCA limit.
Visualization & Reporting
The strategy provides:
Users may restrict execution to a custom backtest range or allow the strategy to operate across the full visible chart history.
Risk Disclosure
This script is for educational and analytical purposes only and does not constitute investment advice.
All core parameters are fully user-configurable. The strategy logic does not enforce a fixed trading style; behavior depends entirely on user-selected settings.
General Structure
The strategy operates in one direction at a time (Long or Short).
All position management logic is applied relative to the selected direction.
- The following components are fully controlled by the user:
- Trade direction (Long / Short)
- Entry model
- Entry filters
- Take-profit percentage
- DCA distance percentage
- TP/DCA increment scaling mode
- Order size model
- Maximum DCA steps
- Risk management options
- Exit model selection
The strategy plan is visualized either across the entire chart history or within a user-defined custom backtest date range.
Entry Configuration
Users can select the entry model:
- Structural breakout
- RSI reversal
- Trend flip
- None (manual disable)
Optional entry filters refine signal selection based on:
- Reward space
- Entry quality
- RSI extremity
- Fair value (VWMA)
- Trend alignment
DCA & Position Scaling
After initial entry:
- Additional DCA orders are triggered when price deviates from the average position price by the defined DCA percentage.
- DCA distance and take-profit levels expand step-by-step according to the selected scaling mode.
- Order size progression depends on the selected order size model.
- Maximum DCA steps define the upper exposure limit.
This ensures the full theoretical risk is bounded and visible.
Exit Models
Users can choose the exit behavior:
- Fixed take-profit
- Structure-based exit
- Adaptive Fast
- Adaptive Slow
- Protect Profit
- Trend Ended
- None
All exits are executed using market orders.
Additional Risk Controls
Optional risk features include:
- DCA Compression (partial size reduction after recovery)
- Defensive Profit Exit
- Trend Soft Stop (breakeven protection after trend reversal)
These mechanisms are configurable and do not override the predefined maximum DCA limit.
Visualization & Reporting
The strategy provides:
- Active position tracking
- DCA step monitoring
- Position notional transparency
- Trend strength visualization
- Historical DCA performance summary
Users may restrict execution to a custom backtest range or allow the strategy to operate across the full visible chart history.
Risk Disclosure
- The maximum DCA step defines the full predefined risk envelope.
- Strong and sustained one-directional trends may lead to full DCA utilization.
- The strategy does not attempt unlimited recovery.
- Users are responsible for configuring position sizing and DCA parameters relative to their capital.
This script is for educational and analytical purposes only and does not constitute investment advice.
Phát hành các Ghi chú
The visual error in Protect Profit mode has been fixed.Phát hành các Ghi chú
Added Micro Trend Exit model for low timeframes.Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.