OPEN-SOURCE SCRIPT

DCA KuCoin Strategy Backtesting [ScrimpleAI]

This script is a backtester for a Dollar Cost Averaging (DCA) strategy on KuCoin, developed for TradingView. It allows users to simulate recurring investments in an asset, test different configurations, and find the best parameters to maximize performance. The script provides a detailed simulation of a DCA strategy, analyzing the impact of different configurations on investments over time. It is designed to be open-source on TradingView, offering a free tool to optimize the use of DCA bots on KuCoin.

Strategy Settings
The script uses an initial capital of 10,000 euros and sets a commission of 0.07 percent per trade. The invested amount is set as a percentage of equity, supporting up to 100 open trades simultaneously. Orders are processed at the close of each candle, and trading is conducted in euros.

Customizable Parameters
The script allows users to choose the investment interval, ranging from a minimum of one hour to a maximum of two weeks. Users can set the amount invested per trade, with a default value of 1,000 USDT and a minimum of 2 USDT. A maximum investment limit can also be defined, preventing further trades once this limit is reached. Additionally, a profit target is available, expressed as a percentage, indicating the profit level at which all positions will be closed.

Backtesting Period Selection
Users can select a specific time range to test the strategy. The bot will execute trades only within this period.

Strategy Logic
The bot makes the first purchase when no trades are open, using the current closing price to calculate the quantity of assets to buy. Subsequent purchases occur at the specified frequency, provided the invested capital does not exceed the set maximum limit. When total equity surpasses the initial value plus the profit target, the bot closes all positions to secure the profit. A check is implemented to prevent errors related to opening and closing trades simultaneously.

Error Management
The script ensures that the selected timeframe is compatible with the chosen investment interval. If the timeframe is too high compared to the investment frequency, an error is triggered. Additionally, if available capital becomes negative, the script stops execution and suggests modifying the test parameters.

免責聲明