This strategy is named “Dynamic Threshold Price Change Breakout Strategy”. The main idea of this strategy is to set a dynamic threshold, and when the price change rate exceeds this threshold, a buy signal is generated, and when the price change rate is lower than the negative value of this threshold, a sell signal is generated. At the same time, the strategy also sets a stop loss. When the price falls below the lowest price of the previous 6 candles, the position will be closed.
The core of this strategy is to calculate the price change rate, which is obtained by dividing the current closing price by the previous closing price and then subtracting 1. Then, the calculated price change rate is compared with the threshold input by the user. When the price change rate is greater than or equal to the threshold, if there is no current position or a short position is held, a buy signal is generated; when the price change rate is less than or equal to the negative value of the threshold, if there is no current position or a long position is held, a sell signal is generated. After generating a buy signal, the strategy will record the lowest price of the previous 6 candles as the stop loss price. Once the price falls below the stop loss price, the strategy will close the long position.
The “Dynamic Threshold Price Change Breakout Strategy” generates trading signals by comparing the price change rate with a dynamic threshold, which is suitable for use in rising markets. The strategy logic is simple and clear, with a certain degree of flexibility and risk control capabilities. However, this strategy also has some shortcomings, such as frequent trading in volatile markets and inflexible stop loss settings. In the future, we can consider optimizing the strategy from aspects such as introducing more indicators, optimizing stop loss settings, optimizing parameters, and adding position management to further improve the performance of the strategy.
/*backtest start: 2023-04-01 00:00:00 end: 2024-03-31 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("Price Change", shorttitle="Price Change", overlay=true) change = input(00.1, title="Change", minval=0.0001, maxval=1, type=input.float) // Calculate price change priceChange = close / close[1] - 1 // Buy and Sell Signals buyp = priceChange >= change sellp = priceChange <= (change * -1) // Initialize position and track the current position var int position = na // Strategy entry conditions buy_condition = buyp and (na(position) or position == -1) sell_condition = sellp and (na(position) or position == 1) var float stop = na if (buy_condition) strategy.entry("Long", strategy.long) stop := lowest(low, 6) position := 1 if (sell_condition or low < stop) strategy.close("Long") position := -1 // Plot Buy and Sell signals using plotshape plotshape(series=buy_condition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small) plotshape(series=sell_condition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)