Heikin-Ashi trend strategy
On NQ futures, the Heikin-Ashi trend strategy lost $99,080 after costs and ran a $100,000 account down to its margin on April 10, 2023. The run stops there.
TrendSwingDaily barsBacktested Nov 6, 2026
Heikin-Ashi trend backtest, the result
Contract
E-mini Nasdaq-100
-
−$99.1K
Net after costs
After $14,140 in fees and slippage
-
3 of 8
Years that made money
January 2016 to April 2023
-
−$166K
Largest drawdown
Peak to trough, 1 contract
-
−$227
Average trade
436 trades
Net after costs by month, January 2016 to April 2023.
Heikin-Ashi trend rules
Daily Heikin-Ashi candles smooth the trend. Each change of colour reverses the position, so it is always in the market.
A drawing of the rules on a made-up day, not a result.
- The Heikin-Ashi close is (open + high + low + close) / 4 and its open the mean of the previous Heikin-Ashi open and close, on the CME trading day's bars.
- A day whose Heikin-Ashi close is above its open is green and one below is red.
- From the second day the strategy is long while green and short while red, turning round at each colour change.
- Decides on
- Daily bars
- Holds
- Overnight and across days
Results by year
It made money in 3 of 8 years on NQ. Its best year was 2018, +$39,315, and its worst 2022, −$55,464. The account was closed out on April 10, 2023, so the years stop there.
| Year | Net | Trades | Win rate | Drawdown | Buy and hold |
|---|---|---|---|---|---|
| 2016 | +$14,107 | 63 | 41% | −$10,566 | +$5,945 |
| 2017 | −$1,141 | 55 | 35% | −$17,218 | +$29,031 |
| 2018 | +$39,315 | 56 | 48% | −$18,569 | −$2,424 |
| 2019 | −$22,989 | 60 | 40% | −$41,475 | +$47,396 |
| 2020 | +$14,858 | 61 | 44% | −$42,865 | +$82,961 |
| 2021 | −$53,639 | 57 | 30% | −$58,414 | +$69,266 |
| 2022 | −$55,464 | 64 | 39% | −$117,869 | −$111,109 |
| 2023, Jan to Apr | −$34,126 | 20 | 35% | −$37,465 | +$104,685 |
Heikin-Ashi trend backtest results
On NQ it lost $84,940 before costs, then paid $14,140 in fees and slippage.
- Net = before costs − fees − slippage
- NQ: −$84,940 − $1,505 − $12,635 = −$99,080
The interval holds zero: this test cannot tell the average trade from no edge.
Heikin-Ashi trend code and Pine Script
The strategy as the backtest ran it, and the Pine Script our compiler wrote from it for TradingView.
1from atlantive import BUY, SELL, Bars, Strategy2 3 4class HeikinAshiTrend(Strategy):5 """Daily Heikin-Ashi colour, always in the market.6 7 A day is the CME trading day, 18:00 to 17:00 New York (the run's daily bars). The Heikin-Ashi8 close is (open + high + low + close) / 4 and its open the mean of the previous Heikin-Ashi open9 and close (the first day's is (open + close) / 2). A day whose Heikin-Ashi close is above its10 open is green and one below is red; an unchanged one keeps the last colour. From the second day11 the strategy is long while the colour is green and short while it is red, turning round at12 each change. Each decision is taken at a daily close and fills at the next session's first13 one-second bar, at the 18:00 New York reopen.14 """15 16 data = "bars"17 18 class Params:19 clip: int = 120 21 class State:22 bars: Bars(interval_ns=86_400_000_000_000)23 ha_open: float24 ha_close: float25 seen: int26 colour: int27 28 def on_event(self, view, ev, orders):29 if not self.bars.update(ev):30 return31 o = float(self.bars.prev_open)32 h = float(self.bars.prev_high)33 lo = float(self.bars.prev_low)34 c = float(self.bars.prev_close)35 if self.seen == 0:36 ha_open = (o + c) / 2.037 else:38 ha_open = (self.ha_open + self.ha_close) / 2.039 ha_close = (o + h + lo + c) / 4.040 self.ha_open = ha_open41 self.ha_close = ha_close42 self.seen += 143 if ha_close > ha_open:44 self.colour = 145 elif ha_close < ha_open:46 self.colour = -147 if self.seen < 2 or self.colour == 0:48 return49 if self.colour == 1:50 if view.position < 0:51 orders.ioc(side=BUY, qty=abs(view.position) + self.p.clip)52 elif view.position == 0:53 orders.ioc(side=BUY, qty=self.p.clip)54 else:55 if view.position > 0:56 orders.ioc(side=SELL, qty=abs(view.position) + self.p.clip)57 elif view.position == 0:58 orders.ioc(side=SELL, qty=self.p.clip) 1//@version=62// HeikinAshiTrend, exported from Atlantive.3// Chart simulation: decisions use completed bars; market orders fill at the next bar open.4// Native fills, fees, data gaps and session boundaries can differ. Re-test on the target symbol.5// Use standard time-based candles and the strategy's timeframe, not synthetic chart prices.6// Pine v6 trims old trade records at its order limit; the strategy keeps calculating.7// Margin is explicitly disabled to retain the native signal simulation's sizing.8strategy("HeikinAshiTrend", overlay=true, initial_capital=100000.0, commission_type=strategy.commission.cash_per_contract, commission_value=1.68, default_qty_type=strategy.fixed, default_qty_value=1, calc_on_every_tick=false, process_orders_on_close=false, slippage=0, margin_long=0, margin_short=0)9 10if timeframe.in_seconds() != 8640011 runtime.error("HeikinAshiTrend was exported for the 1 day timeframe; set the chart to 1D.")12 13clip = input.int(1, "clip", minval=-9007199254740991, maxval=9007199254740991)14 15_q_safe_int(x) =>16 if math.abs(x) > 900719925474099117 runtime.error("an integer left the exact chart range; this run cannot be compared faithfully")18 int(x)19_q_int(x) => _q_safe_int(x < 0 ? math.ceil(x) : math.floor(x))20_q_iadd(a, b) => _q_safe_int(a + b)21 22_q_open = _q_int(math.round(open * 1000000000.0))23_q_high = _q_int(math.round(high * 1000000000.0))24_q_low = _q_int(math.round(low * 1000000000.0))25_q_close = _q_int(math.round(close * 1000000000.0))26 27var float ha_open = 0.028var float ha_close = 0.029var int seen = 030var int colour = 031float o = na32float h = na33float lo = na34float c = na35float ha_open_l = na36float ha_close_l = na37 38bool _q_running = true39o := _q_open * 1.040h := _q_high * 1.041lo := _q_low * 1.042c := _q_close * 1.043if seen == 044 ha_open_l := (o + c * 1.0) / 2.045else46 ha_open_l := (ha_open + ha_close * 1.0) / 2.047ha_close_l := (o + h + lo + c * 1.0) / 4.048ha_open := ha_open_l49ha_close := ha_close_l50seen := _q_int(_q_iadd(seen, 1))51if ha_close_l > ha_open_l52 colour := _q_int(1)53else if ha_close_l < ha_open_l54 colour := _q_int(-1)55if seen < 2 or colour == 056 _q_running := false57if _q_running58 if colour == 159 if _q_int(strategy.position_size) < 060 _q_qty1 = _q_int(_q_iadd(math.abs(_q_int(strategy.position_size)), clip))61 if _q_qty1 <= 062 runtime.error("market order quantity must be a positive whole unit")63 _q_pos1 = _q_int(strategy.position_size)64 if _q_pos1 > 0 or _q_pos1 < 0 and _q_qty1 < -_q_pos165 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")66 strategy.order("q1", strategy.long, _q_qty1)67 else if _q_int(strategy.position_size) == 068 _q_qty2 = _q_int(clip)69 if _q_qty2 <= 070 runtime.error("market order quantity must be a positive whole unit")71 _q_pos2 = _q_int(strategy.position_size)72 if _q_pos2 > 0 or _q_pos2 < 0 and _q_qty2 < -_q_pos273 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")74 strategy.order("q2", strategy.long, _q_qty2)75 else76 if _q_int(strategy.position_size) > 077 _q_qty3 = _q_int(_q_iadd(math.abs(_q_int(strategy.position_size)), clip))78 if _q_qty3 <= 079 runtime.error("market order quantity must be a positive whole unit")80 _q_pos3 = _q_int(strategy.position_size)81 if _q_pos3 < 0 or _q_pos3 > 0 and _q_qty3 < _q_pos382 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")83 strategy.order("q3", strategy.short, _q_qty3)84 else if _q_int(strategy.position_size) == 085 _q_qty4 = _q_int(clip)86 if _q_qty4 <= 087 runtime.error("market order quantity must be a positive whole unit")88 _q_pos4 = _q_int(strategy.position_size)89 if _q_pos4 < 0 or _q_pos4 > 0 and _q_qty4 < _q_pos490 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")91 strategy.order("q4", strategy.short, _q_qty4) How it was tested
The published rules, never tuned on the data, with real costs on every fill. Every strategy here is tested the same way.
- Market data
- CME Globex daily bars, Jan 2, 2016 to Jul 31, 2026
- Rules
- As published, with the published parameters, never tuned on this data
- Size
- 1 contract on every trade
- Contract
- The most traded one, rolled as the market moved
- Fees
- The broker's $0.50 a side, plus CME's and the NFA's fees when the window opens
- Slippage
- 1 tick a side on ES, 2 in NQ's regular session and 3 outside it, 1 on other markets, where it was not measured
- Stops and entries
- Tested on 1-second closes and filled at the next bar
- Contracts traded
- NQ: 43 contracts, NQH6 to NQU6GC: 54 contracts, GCG6 to GCQ6
- Costs paid
- NQ: $1,505 in fees, $12,635 in slippageGC: $2,804 in fees, $13,100 in slippage
- Warm-up
- None: each contract reads only its own bars
- Flagged days
- NQ: NoneGC: None Days the data holds too few bars for. Flagged, not removed.
Could you pass
a prop firm challenge
with the Heikin-Ashi trend strategy?
A backtest says whether a strategy makes money. Our AI runs its trades through the rules of every prop firm account, then tells you which one it would pass and at what size.
No card needed. Free credits every month.
- Most money: Blue Guardian Futures Direct 50K, $5,084
- Best payout odds: Funded Futures Family Straight to Funded 50K, 98%
- Fastest pass: Phidias Express to Live 50K, 11 days
$5,084
Median net across 2,000 simulated runs
- Evaluation
- None
- First payout
- 97%
- Fees paid
- $1,521
Median net across 2,000 simulated runs
Questions about the Heikin-Ashi trend strategy
What is the Heikin-Ashi trend strategy?
Daily Heikin-Ashi candles smooth the trend. Each change of colour reverses the position, so it is always in the market. The rules follow Dan Valcu (introduced the Japanese technique in the West), Using the Heikin-Ashi Technique, Technical Analysis of Stocks & Commodities V.22:2 (2004). Atlantive backtested it on CME futures from January 2016 to July 2026 after costs.
Is the Heikin-Ashi trend strategy profitable on NQ futures?
Not in this backtest: on NQ futures from January 2016 to April 2023 it lost $99,080 after costs, over 436 trades, positive in 3 of 8 years; on GC it made $36,636. Buying and holding one NQ contract over the same window made $401,004. The average trade was −$227, its 95% interval −$693 to $238. These are hypothetical results of a backtest, not of trading.
What are the Heikin-Ashi trend strategy's rules?
The Heikin-Ashi close is (open + high + low + close) / 4 and its open the mean of the previous Heikin-Ashi open and close, on the CME trading day's bars. A day whose Heikin-Ashi close is above its open is green and one below is red. From the second day the strategy is long while green and short while red, turning round at each colour change. The rules follow Dan Valcu (introduced the Japanese technique in the West), Using the Heikin-Ashi Technique, Technical Analysis of Stocks & Commodities V.22:2 (2004). Its parameters are the published ones, never tuned on the data it was tested on.
How was the Heikin-Ashi trend strategy backtested?
On CME Globex data from January 2016 to July 2026, one contract, on daily bars, rolled to the most traded contract as the market moved, with the broker's and CME's fees and the slippage measured on each market. Stops and entries were tested on 1-second closes and filled at the next bar. Nothing was fitted to the data.
Can I run the Heikin-Ashi trend strategy in TradingView?
Yes. The page carries its Pine Script, written by Atlantive's compiler from the same code the backtest ran, for TradingView's strategy tester. A chart's fills and fees can differ from the backtest's, so test it again on the symbol you trade.
Can I change the Heikin-Ashi trend strategy and test it again?
Yes. Rerun it in Atlantive: a new chat opens with the strategy's rules in the box, for you to read, change and send. The agent writes the code, backtests it on the market and window you name, and reports the result with its costs.