This is a short-term trading strategy that issues buy and sell signals based on 0.5% changes in the Heikin-Ashi close price. It is only suitable for Heikin-Ashi candlestick charts and works best at periods of 2 hours, 1 hour, and 30 minutes.
The core logic of this strategy is: Go long when the Heikin-Ashi close price rises 0.5% compared to the previous candlestick; Go short when the Heikin-Ashi close price falls 0.5% compared to the previous candlestick.
Specifically, the strategy first calculates the percentage change between the current close price and the previous close price, i.e. priceChange = close / close[1] - 1
. If priceChange >= 0.005
, a long signal is issued. If priceChange <= -0.005
, a short signal is issued.
When issuing signals, the strategy also judges whether there is an existing position. If already in position (long or short), no signal will be repeated. If there is no position, it will issue open position signals based on the buy or sell conditions.
Finally, plotshape
is used to mark the buy and sell signals on the chart.
The main aspects to optimize this strategy:
In summary, this is a very simple, low parameter, easy to understand short-term trading strategy. It catches price changes extremely fast, suitable for high frequency traders. But also need to control number of trades to reduce costs. With several optimization methods, it can achieve even better results.
/*backtest start: 2022-12-11 00:00:00 end: 2023-12-17 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("Heikin-Ashi - Change 0.5% short Time Period", shorttitle="Heikin-Ashi - Change 0.5% short Time Period", overlay=true) // Calculate 0.5% price change priceChange = close / close[1] - 1 // Buy and Sell Signals buyp = priceChange >= 0.005 sellp = priceChange <= -0.005 // 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) if buy_condition strategy.entry("Buy", strategy.long) position := 1 if sell_condition strategy.entry("Sell", strategy.short) 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)