OPEN-SOURCE SCRIPT

Scale In : Scale Out

Updated
Scale In : Scale Out strategy is an adaptation and extension of dollar-cost-averaging.

As the name implies it not only scales in - allocates a given percentage of available capital to buy at each bar - it also scales out - sells a given percentage of holdings at each bar when a target profit level is reached.

The strategy can potentially mitigate risks associated with market timing.

Although dollar-cost-averaging is often recommended as a strategy for building a position, the management of taking and retaining profits is not often addressed. This strategy demonstrates the potential benefits of managing both the building and (full or partial) liquidation of an investment.

We do not provide any mechanism for managing stop losses. We assume a scale in/out strategy will typically be applied to investing in assets with a high conviction thesis based on criteria external to the strategy. If the strategy does not perform, then the thesis may need to be re-evaluated, and the position liquidated. Even in this case, scaling out should still be considered.
Release Notes
Scale In : Scale Out strategy is an adaptation and extension of dollar-cost-averaging.

As the name implies it not only scales in - allocates a given percentage of available capital to buy at each bar - it also scales out - sells a given percentage of holdings at each bar when a target profit level is reached.

The strategy can potentially mitigate risks associated with market timing.

Although dollar-cost-averaging is often recommended as a strategy for building a position, the management of taking and retaining profits is not often addressed. This strategy demonstrates the potential benefits of managing both the building and (full or partial) liquidation of an investment.

We do not provide any mechanism for managing stop losses. We assume a scale in/out strategy will typically be applied to investing in assets with a high conviction thesis based on criteria external to the strategy. If the strategy does not perform, then the thesis may need to be re-evaluated, and the position liquidated. Even in this case, scaling out should still be considered.
Release Notes
Scale In : Scale Out strategy is an adaptation and extension of dollar-cost-averaging.

As the name implies it not only scales in - allocates a given percentage of available capital to buy at each bar - it also scales out - sells a given percentage of holdings at each bar when a target profit level is reached.

The strategy can potentially mitigate risks associated with market timing.

Although dollar-cost-averaging is often recommended as a strategy for building a position, the management of taking and retaining profits is not often addressed. This strategy demonstrates the potential benefits of managing both the building and (full or partial) liquidation of an investment.

We do not provide any mechanism for managing stop losses. We assume a scale in/out strategy will typically be applied to investing in assets with a high conviction thesis based on criteria external to the strategy. If the strategy does not perform, then the thesis may need to be re-evaluated, and the position liquidated. Even in this case, scaling out should still be considered.
Release Notes
Scale In and Scale Out of an asset investment.

Release Notes
Scale In : Scale Out strategy is an adaptation and extension of dollar-cost-averaging.

As the name implies it not only scales in - allocates a given percentage of available capital to buy at each bar - it also scales out - sells a given percentage of holdings at each bar when a target profit level is reached.

The strategy can potentially mitigate risks associated with market timing.

Although dollar-cost-averaging is often recommended as a strategy for building a position, the management of taking and retaining profits is not often addressed. This strategy demonstrates the potential benefits of managing both the building and (full or partial) liquidation of an investment.

We do not yet provide any mechanism for managing stop losses. We assume a scale in/out strategy will typically be applied to investing in assets with a high conviction thesis based on criteria external to the strategy. If the strategy does not perform, then the thesis may need to be re-evaluated, and the position liquidated. Even in this case, scaling out should still be considered.
Release Notes
Changed calculation of value of buy scaling and take profit scaling trades to avoid ever diminishing trade sizes.

For example, when scaling in the previous method took X% of deployable cash for each buy. As the deployable cash balance decreases with each buy, the value of X% also decreases, leading to an ever diminishing buy value. This does not properly execute the requirement of multiple same-sized buys over an expected number of bars (time period).

The revised method converts X% to a fixed dollar value on the first buy (following start of strategy, or following a take profit phase) and uses that value for each buy until deployable cash is exhausted or a take profit phase is entered.

Similarly for scaling profit taking, but a fixed quantity of the asset is used, rather than a dollar value.
Release Notes
Just wanted to share this totally crazy and (unfortunately) unrepeatable result trading BTC starting September 2012 using Scale In : Scale Out strategy.

Generated a 747,053% (747x) return.
Compared to Buy & Hold return of 346,522% (346x).

PARAMETERS
Asset: BTCUSD on BITSTAMP
Period: 2012-09-10 to 2024-01-23
Initial Capital: $1,000,000
Buy Scaling Size: 4%
Take Profit Level: 700%
Take Profit Size: 2%
Retain Profits Portion: 0%
Minimum Position Value: $250,000
Minimum Buy Value: $10
Annual Interest Rate: 0%

RESULTS
Current Capital: $7,471,535,900
Realized PL: $2,978,490,252
Open PL: $4,492,045,648
Total PL: $7,470,535,900
Sortino Ratio: 50.693
dollar-cost-averagingPortfolio managementscalinginscalingout

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer