bicapitalec

Position size in dollar cost average strategy

STATIC DCA
Using the tradingview.com, an algorithm was generated that simulates the behavior of the DCA methodology. This algorithm simulates the purchase of 1000 USD on the 15th of each month, regardless of the bitcoin price. It is considered a static DCA, since the amount to be invested remains always fixed.
The inputs to the function are, the day number of the month in which the purchase is to be made, the start date of the simulation and the capital to be invested month by month. What the function does is to receive the value of the investment, and if the day entered in the function coincides with the current day, it will divide the invested capital by the price of the asset, obtaining a position size that accumulates in each purchase. With this data we can obtain the total invested capital, the net profit, as well as the average buying price.

DYNAMIC DCA
The dynamic DCA, bases its operation on the use of moving averages and standard deviations, in order to find the zones where the price has a lower value than the deviation under the mean. This condition can be considered as an accumulation zone.
The data were obtained in a one-week time window, using the security request method. Since purchases are made one every month, the daily time window generates many false signals, while the one-month time window generates few signals. The analysis is performed on data from 52 weeks equivalent to one year.
Subsequently we created an algorithm based on the ATR, for the selection of the position size, the fundamental characteristic of this development is that the algorithm will not invest the total of the capital destined to month to month. The amount of money to be invested will vary between 0 and 100%, in discrete values defined by the mean and standard deviation in the ATR calculation. Uninvested money will accumulate until the asset price enters the accumulation zone, where this capital will be released and used to accumulate as much of the asset as possible.
The function developed for the dynamic DCA receives the same inputs as the previous function, plus an extra condition and the variable resulting from the calculation of the position size.

---

ANALYSIS
In the analysis, we will consider ratios, such as cumulative position size, percentage net profit, invested amount and average buying price. The simulation of the results starts on 12/18/2017. For the analysis in all charts, the red line will represent the static DCA ratios, while the blue line will represent the dynamic DCA ratios.

Amount invested
At the end of this backtesting, the quantity invested is the same for each of the cases, however, the way the money enters the market is different. Money enters steadily and in the same amount in the static DCA, while in the dynamic DCA, there are months in which no purchases are made, or partial purchases are made. The remaining capital that accumulates and flows into the market, when bitcoin reaches its lowest price and enters accumulation zones.

Accumulated position size
It can be noted that the dynamic DCA strategy obtains a better result, accumulating a total of 6.62 bitcoins, 18% higher than the static DCA strategy.

Percentage net profit
The static DCA strategy in the last rally was approximately 40% lower in percentage return on invested capital than the dynamic DCA strategy.

Average buying price
In the initial part of the simulation the average buying price of bitcoin using the static DCA strategy was lower, however, as time went on, the dynamic DCA strategy obtained a better average buying price, with 15% cheaper.
---

CONCLUSIONS
The dynamic DCA strategy was more efficient in the use of investment resources.
- One of the main advantages of the dynamic DCA strategy is that it will allow us to enter the spot market even after it has passed its parabolic growth cycle. We will be able to accumulate bitcoin in the bearish regime, having our largest purchases in the accumulation zone.
- Due to these characteristics, the time in which we stay in negative returns is going to be shorter than with a DCA strategy.
- This algorithm can be tested on different assets, extrapolated to Python and by connecting via API, you can configure the automatic purchase of cryptocurrencies, which generates an accumulation of assets based on back testing, relatively superior to what several wallets and exchanges offer.
- The parameters for configuring the dynamic DCA strategy are quite basic and do not require professional knowledge, and the optimal configuration can be obtained by visualizing the results.

Gracias por seguirme!!

Héctor Sandoval and John Jairo Garcia
bicapital.io
受保護腳本
該腳本是閉源發佈的,您可以自由使用。您可以把它加入到常用以在圖表上使用它。您無法查看或修改其原始碼。
免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?