Skip to content
All library documents

Crypto Dollar-Cost Averaging with Optional Safety Orders and Trailing Exits

Article TradingView scripts

Summary

This long-only strategy simulates an initial purchase followed by recurring dollar-cost averaging orders at a configurable interval measured in chart candles. Users can choose among several price sources and set a date window, base order amount, and leverage. Optional safety orders add to the position after price falls by a threshold from a tracked high; the code allows scaling order size and spacing and sets a maximum number of safety orders.

The script includes a dashboard for position size, average price, open trades, and peak liquidity use. Profit-taking is configurable, with an optional trailing exit that closes the position after a pullback from a tracked high. However, take profit and safety orders are disabled by default, and the document supplies no backtest results. The take-profit input is explicitly marked as unfinished in its label, so the behavior should be inspected before relying on it. Repeated averaging and scaled safety orders can increase exposure during a prolonged decline; the dashboard reports usage but does not impose a portfolio risk cap.

Key ideas

  • The strategy opens an initial long position and can add recurring purchases at a candle-based interval.
  • Optional safety orders add exposure after price declines from a tracked high.
  • Safety order size and price spacing can be scaled, with a configurable order limit.
  • A trailing exit can close the position after price retreats from a tracked peak.
  • Profit-taking and safety orders are disabled by default, and no performance evidence is provided.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.