The core idea of this strategy is to buy when the closing price of the stock is higher than the opening price of the day. When the buy condition is met, the strategy will go long at the close of that candlestick at the closing price. Stop loss price and take profit price will then be set. When the price reaches these two prices, the position will be closed.
If the closing price of the daily candlestick is higher than the opening price, it means that the stock price rose on that day. This is a buy signal. The breakthrough of the closing price from the opening price indicates that the buying power is quite strong and the stock price is likely to continue rising.
Therefore, the trading signal for this strategy is: Daily Candlestick Close Price > Daily Candlestick Open Price. When this condition is met, buy at the closing price at the close of that candlestick and hold daily.
This strategy uses two parameters:
Entry Price: The buying price, the default is 0, which means buying at the closing price
Take Profit Parameter: Take profit parameter, the take profit price formula is: Entry Price * (1 + Take Profit Parameter), the default value is 0.5%, equivalent to 0.5% of the entry price
The specific trading process is as follows:
This strategy has the following advantages:
There are also some risks with this strategy:
The risks can be reduced by:
This strategy can be optimized in the following aspects:
This strategy generates buy signals based on close price breakthrough. The idea is simple with small drawdown risk. By adding confirmation indicators, dynamic stop loss/take profit, parameter optimization etc., the stability and profitability of the strategy can be further improved. Overall speaking, this strategy is suitable for investors who are interested in opening price breakthrough strategies to use and optimize, and has very good practicality.
/*backtest start: 2024-02-19 00:00:00 end: 2024-02-20 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Buy on Close Strategy", overlay=true) // Входные параметры var float entry_price = na if (na(entry_price)) entry_price := input.float(title="Entry Price", defval=0) // Функция для расчета Take Profit calc_take_profit(price) => price * 1.005 // 0.5% от суммы сделки // Проверяем условие для открытия позиции на покупку buy_condition = close > open // Переменная для отслеживания открытой позиции var bool open_position = na // Реализация стратегии if (buy_condition) // Открываем сделку на покупку strategy.entry("Buy", strategy.long) open_position := true // Закрываем позицию по Take Profit или при закрытии свечи if (open_position) // Рассчитываем уровень Take Profit take_profit_level = calc_take_profit(entry_price) // Закрываем сделку по Take Profit strategy.exit("Take Profit", "Buy", limit=take_profit_level) // Закрываем сделку при закрытии свечи if (close < open) strategy.close("Close Candle", "Buy")