OPEN-SOURCE SCRIPT
RedFlag: Dynamic Step DCA Strategy

Based on RedFlag idea from HamsterBot guys.
RedFlag: Dynamic Step DCA is a grade Dollar Cost Averaging (DCA) tool designed to capitalize on market corrections. Instead of trying to catch the exact bottom, this strategy uses a system of Safety Orders (SO) to systematically lower your Average Entry Price as the market drops.
Unlike simple linear DCA bots, this strategy features a Dynamic Geometric Grid. This means you can configure the distance between buy orders to expand with every step, allowing you to cover significantly deeper market drawdowns without exhausting your capital on minor fluctuations.
Key Features
⚙️ Settings & Configuration Guide
Here is a detailed explanation of every parameter in the settings menu:
1. Entry Settings
2. Safety Orders (Averaging) Settings
This is the core engine of the strategy.
Safety Order Step %: The distance required for the first Safety Order (DCA buy) after the initial entry.
Safety Order Step Scale: The "Elasticity". This multiplier determines how the grid expands.
- 1.0: Linear Grid. Every buy order is spaced equally (e.g., -1%, -1%, -1%).
- 1.2 - 1.5: Geometric Grid (Recommended). Each step becomes wider.
Example (Scale 1.5): Step 1 is 1%, Step 2 is 1.5%, Step 3 is 2.25%. This saves capital for deeper drops.
Calculate SO from Avg Price:
☑ ON: The next buy level is calculated from your Average Position Price. This is a "Moving Grid" that chases the price down efficiently.
☐ OFF: The next buy level is calculated from the original Source Price (Static Grid).
Max Safety Orders Count: The maximum number of additional buys allowed. This protects you from buying indefinitely during a market crash.
3. Exit Settings
Take Profit %: The profit target.
Important: This is always calculated from your Average Position Price, not the first entry price. This allows you to close the deal in profit even if the price never returns to the all-time high.
RedFlag: Dynamic Step DCA is a grade Dollar Cost Averaging (DCA) tool designed to capitalize on market corrections. Instead of trying to catch the exact bottom, this strategy uses a system of Safety Orders (SO) to systematically lower your Average Entry Price as the market drops.
Unlike simple linear DCA bots, this strategy features a Dynamic Geometric Grid. This means you can configure the distance between buy orders to expand with every step, allowing you to cover significantly deeper market drawdowns without exhausting your capital on minor fluctuations.
Key Features
- Smart Entry: Places a Limit Order below the current price to catch "wicks" and immediate dips.
- Dynamic Grid Expansion: The distance between Safety Orders can increase exponentially (e.g., 1% -> 1.5% -> 2.25%), allowing you to survive high volatility.
- Moving Target Logic: Safety orders can be calculated based on your Average Position Price, meaning the grid adapts to your actual break-even point.
- Auto-Take Profit: The exit target automatically adjusts as your average price lowers, ensuring you exit with a profit on the first significant rebound.
⚙️ Settings & Configuration Guide
Here is a detailed explanation of every parameter in the settings menu:
1. Entry Settings
- Source Price: The price data used for calculations (Default: Close).
- Base Order Drop %: The "Trigger". The strategy places the very first Buy Limit order this many percent below the current price. Example: If set to 1.0% and price is $100, the bot waits to buy at $99.
2. Safety Orders (Averaging) Settings
This is the core engine of the strategy.
Safety Order Step %: The distance required for the first Safety Order (DCA buy) after the initial entry.
Safety Order Step Scale: The "Elasticity". This multiplier determines how the grid expands.
- 1.0: Linear Grid. Every buy order is spaced equally (e.g., -1%, -1%, -1%).
- 1.2 - 1.5: Geometric Grid (Recommended). Each step becomes wider.
Example (Scale 1.5): Step 1 is 1%, Step 2 is 1.5%, Step 3 is 2.25%. This saves capital for deeper drops.
Calculate SO from Avg Price:
☑ ON: The next buy level is calculated from your Average Position Price. This is a "Moving Grid" that chases the price down efficiently.
☐ OFF: The next buy level is calculated from the original Source Price (Static Grid).
Max Safety Orders Count: The maximum number of additional buys allowed. This protects you from buying indefinitely during a market crash.
3. Exit Settings
Take Profit %: The profit target.
Important: This is always calculated from your Average Position Price, not the first entry price. This allows you to close the deal in profit even if the price never returns to the all-time high.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。