0bps

Strategy vault / Grid

Heikin Ashi 05 Change Short Period Trading Strategy

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…

Author
ChaoZhang
Complexity
Starter · 37 lines
Parameters
0
Backtest bar
1d · swing
Tested on
BTC/USDT · futures

IMG

Overview

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.

Strategy Logic

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.

Advantages

  • Using Heikin-Ashi rate of change as trading signal, which captures price trend changes better than simple moving average etc.
  • Issuing signals based on tiny 0.5% price changes, making it extremely sensitive and suitable for short-term trading
  • Very simple and straightforward logic, easy to understand and implement
  • Applicable to multiple timeframes, highly flexible

Risks and Solutions

  • Heikin-Ashi itself focuses more on short-term price action, prone to market noise and false signals
    • Adjust parameters like only reacting to 1% or 2% changes to lower false signal rates
  • Too sensitive, may over-trade frequently incurring higher fees
    • Adjust holding period, e.g. 2 hours minimum each trade, to avoid high frequency trading
  • Too many graphical markers cluttering the chart
    • Hide plotshapes and only check signals from strategy log

Optimization Directions

The main aspects to optimize this strategy:

  1. Adjust price change threshold based on market volatility and trading style to find optimum parameters
  2. Incorporate stop loss to limit max loss percentage per trade
  3. Add filter with other indicators to avoid unnecessary trades during consolidation
  4. Introduce position sizing for fixed quantity, exponential, grid trading etc.
  5. Optimize entry mechanisms, avoid whipsaws, trade with trend or counter trend

Conclusion

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.

Source Pine Script

/*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)

Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-18. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a grid bot with inventory caps and order deduplication from strategies/Heikin-Ashi-05-Change-Short-Period-Trading-Strategy.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open