The core idea of this strategy is to find the best buy date each month by buying digital assets on that date and selling them at the end of the month, in order to achieve optimal investment returns. This strategy is suitable for investors who want to obtain excess returns by taking advantage of intraday price fluctuations.
The strategy runs based on the user-defined monthly buy date and sell date. It goes long on the buy date by buying assets, and closes the position on the sell date if set. Otherwise, it closes the position on the strategy end date. This can test the profit difference from different monthly buy dates.
The logic for buy signal is: if it is the user-defined buy date and within the effective date range of the strategy, go long.
The logic for close position signal is: if the sell date is set and it is the sell date now, close position; if no sell date but beyond strategy end date, also close position.
Price crash risk after buying
Change of optimal buy date
Loss caused by incorrect parameter setup
Consider more factors in determining entry point
Optimize position management mechanism
Expand to other trading markets
This strategy finds the date of largest intraday price swing each month by testing profit difference from different buy dates. It can bring excess returns for investors seeking profits from high frequency intraday trading. Further improvement on determining entry timing, position management and expanding application scope will enhance the stability and profitability of the strategy.
/*backtest start: 2023-10-01 00:00:00 end: 2023-10-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © dennis.decoene //@version=4 strategy(title="Buy and Hold, which day of month is best to buy?", overlay=true) // Make input options that configure backtest date range startDate = input(title="Start Date", type=input.integer, defval=1, minval=1, maxval=31, group="Starting From") startMonth = input(title="Start Month", type=input.integer, defval=1, minval=1, maxval=12, group="Starting From") startYear = input(title="Start Year", type=input.integer, defval=2021, minval=1800, maxval=2100, group="Starting From") endDate = input(title="End Date", type=input.integer, defval=2, minval=1, maxval=31, group="Until") endMonth = input(title="End Month", type=input.integer, defval=10, minval=1, maxval=12, group="Until") endYear = input(title="End Year", type=input.integer, defval=2021, minval=1800, maxval=2100, group="Until") entryday = input(title="Entry Day", type=input.integer, defval=26, minval=1, maxval=31, tooltip="When to enter (buy the asset) each month") exitday = input(title="Exit Day", type=input.integer, defval=6, minval=1, maxval=31, tooltip="When to exit (sell the asset) each month") useExitDay= input(title="Close position on exit day?", type=input.bool, defval=false, tooltip="Use the Exit Day to close each months position it true or close at the end of the period (if false)") isEntryDay= (dayofmonth(time)==entryday) isExitDay= (dayofmonth(time)==exitday-1) inDateRange = true if (isEntryDay and inDateRange) strategy.entry(id="Buy", long=true) if (isExitDay and useExitDay) strategy.close_all() // Exit open market position when date range ends if (not inDateRange and not useExitDay) strategy.close_all()