TRADLEWARE-DCA — Strategy by cs_lev

By cs_lev

Performance Metrics

Description

Dollar-Cost Averaging BenchmarkThis is a passive reference strategy, not a signal-based trading system. It exists to give an honest, apples-to-apples comparison for active strategies: instead of trying to time entries, it buys a fixed amount of the asset on a regular schedule until a set capital budget is fully deployed.How it worksDollar-cost averaging (DCA) means investing a fixed amount of money at regular intervals, regardless of price. Some buys land at high prices, some at low prices, and over time the average purchase price smooths out. There is no attempt to predict direction — the schedule is the whole strategy.This script buys on either a fixed day of the week (e.g. every Monday) or every fixed number of bars (e.g. every 30 daily bars, roughly monthly), and keeps buying until the total amount invested reaches the strategy's starting capital. After that, no more buys are placed — the same total capital pool as whatever active strategy this is being compared against, with no extra money added along the way.EntryA buy is placed each time the schedule fires, as long as the running total invested plus the next buy amount does not exceed the starting capital. If a scheduled buy would push the total over budget, it is skipped, but the schedule keeps advancing rather than getting stuck retrying.ExitThere is no exit signal in the usual sense — the strategy only ever adds to its position. The full position is closed out once, on the final bar of the chart's history, purely so the backtest can report a final equity figure. This is bookkeeping, not a trading decision.Parameters Start Date / End Date: window during which buys are allowed Use Day of Week Mode: switch between "buy on a specific weekday" and "buy every N bars" Day of Week: which weekday to buy on, when day-of-week mode is on Every X Bars: how many bars between buys, when day-of-week mode is off (30 on a daily chart is roughly monthly) Amount per buy: fixed amount invested at each scheduled buyThe strategy allows up to 500 stacked buy layers to accumulate into a single overall position — that number just needs to be large enough to never run out before the capital budget is spent; it is not a trading parameter to tune.Costs modelled0.1% commission per side, 3 ticks slippage, fills at the same bar's close (this benchmark intentionally fills immediately rather than waiting for the next bar's open, since there is no signal timing to protect).Intended assets and timeframeWorks on any asset or timeframe — the frequency inputs just need to be set to match (e.g. 30 bars on a daily chart for roughly monthly buys, 7 for weekly). For higher-priced assets, check that the per-buy amount converts to at least a fraction TradingView will actually simulate.Known limitationsThe starting capital, buy amount, and buy frequency together decide how long full deployment actually takes — and depending on the chart's date range, that can run out in either direction. With the default settings (10,000 starting capital, 100 per buy, roughly monthly), full deployment takes 100 buys — about 8 years of monthly investing. Starting from 2018-01-01, that budget is exhausted by roughly mid-2026, so on a chart that runs through mid-2026 or later, this script will have already placed its last scheduled buy weeks or months before the present: it simply holds the fully-invested position afterward and stops buying, exactly as designed by the "never invest more than the starting capital" rule, not because of an error. On a shorter chart window relative to the amount and frequency chosen, the opposite can happen instead — the window ends before the full budget is spent, leaving some capital undeployed. Either way, check the strategy's equity and invested-capital tracking rather than assuming full deployment by the end of the chart. This script also has no risk management of any kind by design: it never sells until the very end, so it carries full exposure to any drawdown the asset experiences. That is the intended comparison point for an active strategy, not a flaw to fix.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView