QaSH DCA Algorithm

ParabolicValue Updated   
QaSH DCA Algorithm implements a DCA strategy that takes advantage of price volatility by buying dips to average down, and adjusting price targets as the break-even price gets lower.

How does the DCA strategy work?
When the specified entry condition has occurred, the indicator will set up several limit orders below the current price. If price goes up a specified amount, then the layers will be overwritten at the higher prices. If price goes down and fills the first layer (limit order), then the Take Profit price is plotted and will be sent in an alert. If more layers are filled, then the TP price will move down accordingly as it’s based on the average entry price (alerts on each TP update). This action of lowering the average entry and TP price mitigates your risk, and increases the likelihood of a Take Profit event happening. More entry conditions will be added as time goes on, although complex entry conditions are not necessary for the strategy to work. All the meat of the DCA strategy is in the layer placement, order volume , and TP %.

How does this differ from other DCA bots?
1) The layer placements, order volume , and “take profit %” for each layer or “safety order” is much more customizable than what you get from other services. For example, I can choose to have my TP% change, depending on how big the price dip was. Maybe on safety order 1 I want 10% TP, but on safety order 7 might want a 2% TP.
2) Settings optimization. You can take advantage of the replay feature and see how trades would have played out, and how much PnL you would have made (strategy version is coming soon)
3) You can use this indicator on more than just crypto. You can easily set up alerts for manual trades on stocks, or you can integrate it with your stock broker API of choice and automate your trades.
4) When combining this with an automation service, you will get unmatched execution speed by running it on your dedicated machine.
5) I can offer a lifetime subscription to the indicator upon request.

What kind of market is it best used on?
QaSH DCA Algorithm is best used on cryptocurrencies and stocks, and it is best used on assets that are volatile. That means large swings up and down. Also I recommend running this on many uncorrelated assets at the same time.

What settings should I use?
The default settings are decent for most markets, and provide a good balance between profit potential and downside protection, although you can use a wide variety of settings. In a strong bull market its best to either bring up your layers to catch smaller dips, or you can go big on the first few layers (maybe 4 layers, 25% on each layer for example). In a sideways or brearish market you'll want more downside protection, so you'll want the larger orders to be at lower prices.

What should I do if price goes below my last layer?
The best solution is to keep a cash reserve on the side at all times. If price looks like it has reached a low point below your lowest layer, then manually buy more to average down further. This action will help it along and get you in the green sooner.

Disclaimer: In order to get a large position in an asset, you need to have most of your layers fill. That means you have to be comfortable with buying more as the price goes down, patiently waiting for the bounce that occurs afterward. This is the working principle of Dollar Cost Averaging, and it's a proven method for most markets.
Release Notes:
Hi everyone,
Version 1.1 of the indicator is now released. I made a lot of improvements in this version.

- You no longer need to set up multiple alerts. All events can now be sent via one dynamic alert called "Any Alert() Function call". If you're using all 12 layers, then you paste in your message for each of the 12 layers, and then you can start your alerts with just a couple more clicks. This will be MUCH easier than configuring several alerts. And since it only uses up one alert slot, you can now use this indicator on a free Tradingview account.

- All alert messages are now set up from within the settings window. To start the alerts, make sure they are "checked" and go to the alerts window, then select "Any Alert() Function call" to enable all "checked" alerts.

- Placeholders have been reformatted and a lot have been added. You can now send the volume of each order in the alert. This will make it easier to manage multiple deals running in the same account, and it will also make it easier to follow the alerts manually.
The following placeholders can be used:
{{open}} candle open
{{high}} candle high
{{low}} candle low
{{close}} current price
{{ticker}} ticker being traded
{{base}} price at which the layers will overwrite (if none filled)
{{L1}} {{L2}} ... {{L12}} DCA limit order prices
{{L1_Size}} {{L2_Size}} ... {{L12_Size}} DCA limit order sizes (in quote currency or "contracts")
{{filled_size}} total filled size of the current trade in base currency (the currency you used to buy with)
{{TP}} take profit price
{{time}} returns the current UTC time and date.
Please refer to the alert message tooltips to see what placeholders can be used in which alert messages.

- Rounding function now has a user input for rounding precision. This will affect all layers, base, and TP values. Some exchanges have requirements on tick precision for orders so this will resolve that issue.

- Modified the deal start logic to occur on the first bar instead of the second. It may also run on the second bar, if the calculation runtime took too long. This mostly applies to people who use a sub-1min chart.

- The date/time input has been changed to TradingView's default input. And it now matches your chart timezone.
Release Notes:
- I added two more placeholders:
{{layer_count}} returns the number of layers being used
{{layers_filled}} returns the number of layers that have filled so far.

- I updated the default alert messages to use the new placeholders

- After a TP event, the next deal now starts 2 bars later, instead of immediately. This will allow for processing time of your automation service, and will help ensure your take profit order has time to fill.

- added an optional alert for when price crosses over the break even price
Release Notes:
Version 1.3:
- I removed the "time session" input as it was unnecessary
- I added logic to force the indicator to start on the first bar if your start date is outside of the chart historical range.
- converted to pinescript v5
- added version information at the top of the settings window. You can now tell what version of the script you're using.
Release Notes:
Version 1.4:
- Added information to the default alert messages
Release Notes:
Version 1.4.1-
added clarifications to default alert messages and tooltips
Release Notes:
Version 1.5:
-added the {{volume}} placeholder. This returns the volume of the current bar.
Release Notes:
Version 1.5.1:
- Made improvements to the rounding function and how it applies to plot placements
Release Notes:
Version 1.5.2:
- increased font size on the dashboard table
- corrected info in some tooltips
Release Notes:
Version 1.6 :
- added the ability to see all DCA order locations for all trades during backtesting
- added a placeholder {{L1X}} , {{L2X}} etc. This will return with the price of the layer that just filled. (layer values get zero'd out when they fill. So this placeholder wasn't possible before now)
Release Notes:
Version 1.6.1-
-simplified the {{L1X}}, {{L2X}} .... placeholders. Now just putting in {{LX}} will work for all alerts, and will return the price of the order that most recently filled.
Release Notes:
1.6.3 - minor typo fix
Release Notes:
Version 1.6.4:
- added {{TPX}} placeholder. This will return the take profit price, but unlike {{TP}}, it can be referenced after TP has been crossed.
Release Notes:
Version 1.6.5:
- Improved the PnL calculation to include the profits from each trade, apply it to the balance, and increase the trade sizes proportionally to the increase of balance.
Release Notes:
Version 1.6.6:
- fixed layer 12 visible plot line (the actual value was correct but it wasn't plotting in the right place)
Release Notes:
Version 1.6.7:
Fixed the {{TPX}} placeholder. It's now available in the take profit alert.
Release Notes:
added the new input "backtest" vs "live trades" for alignment with new scripts.

Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact ParabolicValue for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases you can find a good open-source alternative for free in our Community Scripts.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Author's instructions

The author of this script can no longer grant access to it. Please don't request access.

Want to use this script on a chart?

Warning: please read before requesting access.