The Intelligent Accumulator Buy Strategy is a proof of concept strategy. It combines recurring buy-in with technical analysis-based entries and exits.
The strategy will allocate a portion of the funds and continue to increase positions as long as the technical analysis condition is valid. Use the exit technical analysis condition to define your exit strategy.
You can add to losing positions to average down, or choose a more aggressive approach that allows adding to winning positions.
You can choose to take full profit or distribute your exits into multiple take profits of the same size.
You can also decide whether to allow your exit conditions to close your position at a loss or require a minimum take profit percentage.
The strategy contains default technical analysis entry and exit conditions just to showcase the idea, but the final intent of this script is to delegate entries and exits to external sources.
The internal conditions use RSI length 7 crossing below the 1 standard deviation Bollinger Bands for entries and above for exits.
To control the number of orders, adjust the parameters in Settings:
The script is designed as an alternative to daily or weekly recurring purchases, but depending on the accuracy of your technical analysis conditions, it may also prove profitable at lower timeframes.
The reason the script is called Intelligent is because the most common recurring buy does not involve any decision making: buy no matter what with a certain frequency. This strategy still performs recurring purchases but filters out some potential bad entries that can unnecessarily delay seeing the position profitable. The second reason is also having an exit strategy in place from the start, which no recurring buy option offers out of the box.
The strategy determines entries and exits based on the crossover of the RSI indicator with the Bollinger Bands. Specifically, when the RSI is below the lower rail, look for short entries, and when the RSI is above the upper rail, look for long exits.
In addition, the strategy provides settings for pyramiding and batched exits. The sum of the number of pyramiding and the percentage of equity used each time should equal 100 to prevent overuse of funds. You can choose to allow continued pyramiding on winning positions or only pyramiding on losing positions to achieve average down.
When exiting, you can choose to take full profit or exit in batches according to the set percentage. In addition, the minimum profit percentage can be set to avoid exits if the profit is lower than that percentage.
Overall, the strategy combines recurring purchases and technical analysis indicators to achieve more stable pyramiding by filtering out some wrong signals, while setting up flexible exit mechanisms that can be adjusted according to one’s own risk appetite.
Compared with traditional recurring purchase strategies, the biggest advantage of this strategy is that both entries and exits have technical indicators as references, which can filter out some wrong signals, in contrast to the daily and weekly purchases without any decision making. The specific advantages are:
In summary, the strategy realizes the periodic pyramiding effect of recurring purchases while increasing the technical indicator judgment for entries and exits, allows parameters adjustment according to one’s own preferences, reduces the risk of blind entries, and improves profit efficiency.
Although the strategy sets technical indicators filtering and flexible pyramiding/exit mechanisms to reduce risks, there are still inevitable risks for any strategy. The main risks include:
The corresponding solutions are:
The strategy can be further optimized in the following aspects:
The Intelligent Accumulator Buy Strategy retains the periodic pyramiding advantage of recurring purchases while filtering entries and exits with technical indicators and setting clear profit taking/stop loss exit mechanisms, avoiding the disadvantages of blind entries and indefinite holdings. The strategy allows high customization of pyramiding and exit parameters based on personal risk preference, thus very advantageous for long-term holders.
Of course, there are still risks of signal errors and inappropriate parameters, which needs to be addressed through continued optimization of indicators and parameters as well as auxiliary stop loss means. Overall, the strategy forms an important evolution from recurring purchases to intelligent accumulators, providing investors a relatively comprehensive and controllable long-term holding solution.
/*backtest start: 2023-02-19 00:00:00 end: 2024-02-25 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © TheTradingParrot //@version=5 strategy("TTP Intelligent Accumulator", overlay=true) maxEntries = 0.0 if not na(maxEntries[1]) maxEntries := maxEntries[1] rsi = ta.rsi(close, 7) rsima = ta.sma(rsi, 14) bbstd = ta.stdev(rsi, 14) // plot(rsi) // plot(rsima) // plot(rsima - bbstd) // plot(rsima + bbstd) intEntry = rsi < rsima - bbstd intExit = rsi > rsima + bbstd maxEntries := math.max(strategy.opentrades, maxEntries) plot(maxEntries, "maxEntries") addWhileInProfit = input.bool(false, "Add while in profit") extLong = input.bool(false, "", inline = "long") entry = input.source(close,"entry", inline = "long") == 1 if not extLong entry := intEntry longCondition = entry and (strategy.opentrades == 0 or (not addWhileInProfit or close < strategy.position_avg_price)) if (longCondition) strategy.entry("long", strategy.long) minProfit = input.float(0.0, "Required profit % to exit") exitPxcandle = input.float(100.0,"% exit per candle") extShort = input.bool(false, "", inline = "exit") exit = input.source(close,"exit", inline = "exit") == 1 if not extShort exit := intExit shortCondition = exit if (shortCondition and strategy.opentrades > 0) strategy.close("long", qty_percent = exitPxcandle) plot(strategy.position_avg_price, "Avg")