Krugman's Dynamic DCA

krugman25 已更新   
This script helps you create a DCA (dollar-cost averaging) strategy for your favorite markets and calculates the DCA value for each bar. This can be used to DCA daily, weekly, bi-weekly, etc.

Configuring the indicator:
-DCA Starting Price: the price you want to begin DCA'ing
-DCA Base Amount: the $ amount you will DCA when price is half of your starting price
-DCA Max Amount: the maximum amount you want to DCA regardless of how low price gets

The DCA scaling works exactly like the formula used to calculated the gain needed to recover from a given % loss. In this case it's calculated from the DCA Starting Price. The idea is to increase the DCA amount linearly with the increased upside potential.
*Updated panel name
Added a minimum DCA amount to allow users to avoid extremely small DCA buys when the price is close to the dcaStartingPrice. Your DCA will never be smaller than this value as long as price is below the dcaStartingPrice.
I've updated the DCA model to use a more simple linear pricing method. It still works very similar to the previous pricing method where

DCA Starting Price = Market price to begin DCA'ing
DCA Plateau Price = Market price where DCA amount stops increasing (i.e. when the DCA amount "plateaus")
DCA Min Amount/b] = The DCA amount when price initially crosses below the starting price
DCA Max Amount/b] = The DCA amount when price reaches or drops below the plateau price. The DCA amount will not increase beyond this value regardless of how far market price goes below the plateau price.
Added decimals to script variables to allow for DCA coins that are sub $1.
Publishing script to update the chart

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。