One or Two Daily Bars: Testing Confirmation in a Heikin Ashi Follow-the-Trend Model
Heikin Ashi candles (sometimes called bars) are a graphical technical analysis tool for identifying the onset and discontinuation of price uptrends for a stock ticker. This blog started what will be a continuing post series on modeling trade entry and exit dates and prices with Heikin Ashi bar colors. Consecutive green bars indicate a ticker’s prices are growing over those bars. When the green bars transition from green to red, it indicates the rising price trend ceased. Because there are expressions for denoting bar colors, standard backtesting techniques can be employed for evaluating different model designs.
The first post (Backtesting Heikin Ashi Candle Colors to Buy Dips and Exit When Runs End) examined a very simple buy-the-dip model based on Heikin Ashi candles. The second post (A Modeling Framework for Evaluating Multiple Ticker Sets with Heikin Ashi Candle Colors) included a systematic dive into two different models for identifying trade entry and exit dates based on Heikin Ashi bar colors. That post uncovered some evidence to suggest that a follow-the-trend model was more effective than a buy-the-dip at uncovering more profitable trades.
This third post in the series focuses on fine tuning the follow-the-trend model. This post demonstrates a statistical framework for assessing the impact of confirmation days on trade profitability over a ten-year evaluation period. Thirteen widely traded tickers are followed over the evaluation period. The details pertaining to which tickers are tracked and the start and end dates for the evaluation period are covered in the second post within this continuing series.
A Deeper Dive into the Follow-the-Trend Model and Confirmation Days
The initial follow-the-trend model introduced in the second post relies on color bar transitions to signal that a trade is opened or closed on the first trading day after the transition. A transition to a green bar after red bar indicates a trade should be entered for a ticker on the next trading day after the transition. After a trade is launched, then a transition from a green bar to a red bar indicates the current trade should be exited on the trading day after its transition.
- For the follow-the-trend model in the current post, if the day following a red-to-green bar transition also has a green bar, then the initial signal is confirmed and a trade is entered at the open of the next trading session. Conversely, if the day following a red-to-green bar transition has a red bar, then the signal is not confirmed, and a trade is not entered on the next trading day. Succeeding trading days are searched until a successful confirmation day is discovered immediately following a red-to-green transition or until there are no remaining trading days in the evaluation timeframe.
- Confirmation days for exit signals operate similarly. For example, if the day following a green-to-red transition is also a red bar, then the exit signal is confirmed and the trade is exited at the open of the next trading session. In contrast, if a green-to-red transition day is followed by a green bar, then the trade remains open. The trade remains open until the day after a green-to-red transition is followed by a confirming red-bar day.
Implementing the Heikin Ashi Candle Follow-The-Trend Model Backtest for the Current Post
The model backtest for generating trades with the Heikin Ashi candle follow-the-trend model relies on source data (dbo.HA_Dataset table) initially created and populated in the second post. The following script from the second post includes a create table statement which specifies the column names and primary key constraint for the dbo.HA_Dataset table.
- From the primary key constraint, you can see that dbo.HA_Dataset table rows are unique by their ticker_set, bar_period, ticker, [date].
- Ticker and date are common identifiers for rows in an OHLC dataset.
- The dbo.HA_Dataset table design allows it to store data from multiple OHLC datasets. For example, the table was populated initially in the second post with data from two ticker sets named First_HA_Ticker_Set and Long_term6_for_HA.
- The tickers in First_HA_Ticker_Set included: AAPL, AMD, DELL, GOOGL, MSFT, MU, NVDA, VLO, and SPY.
- The tickers in Long_term6_for_HA included: CAT, JPM, LLY, MSFT, NVDA, and SHW.
- The bar_period could be for a day, week, or month. The second post and this post specify a bar_period duration of a day.
- The OHLC column values are stored in the open, high, low, and close columns.
- The corresponding Heikin Ashi candle values are stored in the ha_open, ha_high, ha_low, ha_close.
use securitytradinganalytics;
go
---------------------------------------------------------
-- 1. create the permanent ha table (only if it does not
exist)
---------------------------------------------------------
if object_id('dbo.HA_Dataset', 'U') is null
begin
create table dbo.HA_Dataset
(
ticker_set varchar(50) not null,
bar_period char(1) not null
constraint ck_HA_Dataset_bar_period
check (bar_period in ('D', 'W', 'M')),
ticker varchar(20) not null,
[date]
date not null,
[open] decimal(18,6) not null,
[high] decimal(18,6) not null,
[low] decimal(18,6) not null,
[close] decimal(18,6) not null,
ha_open decimal(18,6) not null,
ha_high decimal(18,6) not null,
ha_low decimal(18,6) not null,
ha_close decimal(18,6) not null,
ha_color varchar(5) not null,
constraint
pk_HA_Dataset
primary key clustered (ticker_set, bar_period, ticker, [date])
);
end;
The next script implements its backtests for four basic configurations of the follow-the-trend model implemented and evaluated in this post. All four configurations are applied to each of the tickers in both ticker sets.
- The four configuration members are:
- One green bar preceded by a red bar for a trade entry signal and one red bar preceded by a green bar for a trade exit signal;
- One green bar preceded by a red bar for a trade entry signal and two red bars preceded by a green bar for a trade exit signal;
- Two green bars preceded by a red bar for a trade entry signal and one red bar preceded by a green bar for a trade exit signal;
- Two green bars preceded by a red bar for a trade entry signal and two red bars preceded by a green bar for a trade exit signal.
On the trading day immediately after each trade entry signal and each trade exit signal, a trade entry or a trade exit is, respectively, executed.
The script below implements a backtest in five sections and displays two result sets. A comment block at the beginning of the script provides a top-level summary of the underlying model logic that the script applies to tickers in the First_HA_Ticker_Set and Long_term6_for_HA ticker sets. It is especially useful to examine this comment block because it succinctly explains key elements of the follow-the-trend model implemented via the script.
Here are some bullets highlighting roles performed by each section or combination of sections in the implementation script. If your scan of the script below does not provide you with the background to understand the script, you are likely to find what you seek to learn more about in these bullets.
- Section 0
- Sets the @bar_period local variable to 'D' to indicate there are daily Heikin Ashi bars in dbo.HA_Dataset. The system for handling Heikin Ashi bars can also process weekly and monthly bars by assigning ‘W’ or ‘M’, respectively, to @bar_period, once bars for that period are loaded into dbo.HA_Dataset.
- The @start_date local variable is set to 2017-02-01. January trading days are reserved for the Heikin Ashi averaging to settle before trades begin in February. Each bar’s ha_open is the prior bar’s ha_open and the prior bar’s ha_close, so ha_open, ha_close, and ha_color values become reliable estimates by early February 2017 trading days.
- The #runs temp table lists every backtest to perform. A cross join pairs each of the two ticker sets with each of the four configurations, giving 8 runs.
- Each configuration is identified by two numbers: entry_greens (1 or 2 green bars to signal an entry) and exit_reds (1 or 2 red bars to signal an exit).
- To help you better understand the contents of the #runs, here is a result set used to populate #runs in this post. The result set contains three columns (ticker_set, entry_greens, and exit_reds) with a total of eight rows.
- The first four rows are for First_HA_Ticker_Set, and the second four rows are for Long_term6_for_HA.
- The four-row set for each ticker set has four combinations for the number of red and green bars associated with entering and exiting trades.
- Section 1
- Creates dbo.HA_Confirm_Trades only if it does not already exist, so the table is not dropped on each run. Trades saved earlier for other ticker sets or bar periods remain in the table.
- As you can see from the create table statement, the main objective for the dbo.HA_Confirm_Trades table is to store trade entry and exit dates and prices, percent change (trade_pct), and the running total of percent changes for its ticker (cum_pct).
- The table’s primary key ensures the uniqueness of each row in dbo.HA_Confirm_Trades. The primary key is defined in terms of ticker_set, bar_period, entry_greens, exit_reds, ticker, and entry_date.
- Section 2
- Section 2 populates dbo.HA_Confirm_Trades based on the configurations for ticker sets trading day data in #runs, trading day data in dbo.HA_Dataset, and backtest logic for deriving trades from configurations and historical trading day data by ticker set.
- A WHILE loop processes one #runs row at a time, taking the next ticker set and configuration in key order. When a run finishes, its row is deleted from #runs. The loop ends when #runs is empty.
- At the start of each run, any trades saved for that ticker set and configuration by an earlier execution are deleted. Re-running the script replaces trades rather than duplicating them.
- Layers are code subsections within section 2.
- Layer 1 (#bars): for each bar, the script looks back to the colors of the two prior bars and the prior date, and looks ahead to the next trading day’s date and open price.
- Layer 2 (#exits): finds exit signals. For a 1-red exit, it’s a red bar preceded by a green bar. For a 2-red exit, it’s a second red bar preceded by a red bar and then a green bar. The exit price is the next trading day’s open.
- Layer 3 (entry_signals): finds entry signals. For a 1-green entry, it’s a green bar preceded by a red bar. For a 2-green entry, it’s a second green bar preceded by a green bar and then a red bar. The entry price is the next trading day’s open.
- Layer 4 (paired): matches each entry with the first exit signal whose red run starts on or after the entry date. Entries before @start_date are dropped. A trade with no later exit signal stays open, with no exit price.
- Layer 5 (trades): an entry signal that occurs while a trade is already open would match the same exit. Only the earliest entry for each exit is kept, so trades never overlap.
- Layer 6 (priced): computes each trade’s percent change from entry price to exit price.
- Final layer: adds the running sum of percent changes within each ticker and saves the trades to dbo.HA_Confirm_Trades, tagged with the ticker set, bar period, and configuration.
- Section 3
- This section returns a result set with the number of closed trades and net percent change for each ticker in the 1-green/1-red configuration. Rows are ordered by ticker within ticker set.
- You can compare the result set from section 3 in this post for the corresponding values from the “Implementing the Heikin Ashi Candle Follow-The-Trend Model Backtest” section of the second post. This will allow you to verify that the results from the 1-green/1-red configuration in the current post match trade counts and net percentage change by tickers within ticker sets.
- Section 4
- This section returns 60 rows (15 ticker rows × 4 configurations).
- Here’s an excerpt with the first twelve rows from section 4.
/* ha follow-the-trend confirmation trades: 1 or 2 bars
in, 1 or 2 bars out ver_1.1
date: 11/5/2026
authors: rick
dobson & Claude
purpose:
backtest four configurations of the heikin ashi follow-the-trend
model
for every ticker set listed in section 0, save every trade
in
dbo.HA_Confirm_Trades, and summarize each ticker's number of
closed
trades and model net change by configuration.
rules: entry signal: the last bar of a run of
@entry_greens consecutive
green ha bars that follows one or more red bars
(1 = the first green; 2 = the second green in a row)
entry: open price on the
trading day after the entry signal
exit
signal: the last bar of a run of
@exit_reds consecutive
red ha bars that follows one or more green bars,
with the whole red run on or after the entry date
(1 = the first red; 2 = the second red in a row)
exit: open price on the
trading day after the exit signal
overlap: a new entry signal
that occurs while a trade is still
open is ignored, so trades never overlap
scope: trades entered on or
after 2/1/2017 (@start_date)
check: the 1-green / 1-red configuration is the
follow-the-trend model
from
the prior post and should reproduce its results
(for
example, cat 190.41 and spy 63.65)
*/
use securitytradinganalytics;
go
---------------------------------------------------------
-- 0. name the ticker sets, bar period, first entry date,
and configurations
---------------------------------------------------------
declare @bar_period char(1) = 'D';
declare @start_date date = '2017-02-01';
drop table if exists #runs;
create table #runs
(
ticker_set varchar(50) not null,
entry_greens
tinyint not null,
exit_reds tinyint
not null,
primary key
(ticker_set, entry_greens, exit_reds)
);
-- every ticker set paired with every configuration (2
sets x 4 configurations)
insert into #runs (ticker_set, entry_greens, exit_reds)
select s.ticker_set, c.entry_greens, c.exit_reds
from (values ('First_HA_Ticker_Set'),
('Long_term6_for_HA')) as s(ticker_set)
cross join (values (1, 1), (1, 2), (2, 1), (2, 2)) as
c(entry_greens, exit_reds);
---------------------------------------------------------
-- 1. create the permanent trades table (only if it does
not exist)
---------------------------------------------------------
if object_id('dbo.HA_Confirm_Trades', 'U') is null
begin
create table
dbo.HA_Confirm_Trades
(
ticker_set varchar(50) not null,
bar_period char(1) not null,
entry_greens tinyint not
null,
exit_reds tinyint not null,
ticker varchar(20) not null,
entry_date date not null,
entry_price decimal(18,6) not
null,
exit_date date null,
exit_price decimal(18,6) null,
trade_pct decimal(18,4) null,
cum_pct decimal(18,4) null,
constraint
pk_HA_Confirm_Trades
primary
key clustered (ticker_set, bar_period, entry_greens,
exit_reds,
ticker, entry_date)
);
end;
---------------------------------------------------------
-- 2. loop through each ticker set and configuration,
replacing its trades
---------------------------------------------------------
declare @ticker_set
varchar(50);
declare @entry_greens tinyint;
declare @exit_reds
tinyint;
while exists (select 1 from #runs)
begin
-- take the
next run in key order
select top 1
@ticker_set = ticker_set,
@entry_greens = entry_greens,
@exit_reds = exit_reds
from #runs
order by
ticker_set, entry_greens, exit_reds;
-- remove this
run's trades from a prior execution
delete from
dbo.HA_Confirm_Trades
where
ticker_set = @ticker_set
and
bar_period = @bar_period
and
entry_greens = @entry_greens
and
exit_reds = @exit_reds;
-- layer 1
(saved in #bars): each bar with the two prior colors, the
-- prior date, and the next trading
day's date and open
drop table if
exists #bars;
select
ticker,
[date],
ha_color,
lag(ha_color, 1) over (partition by ticker order by [date]) as
color_1_back,
lag(ha_color, 2) over (partition by ticker order by [date]) as
color_2_back,
lag([date]) over (partition
by ticker order by [date]) as prev_date,
lead([date]) over (partition
by ticker order by [date]) as next_date,
lead([open]) over (partition
by ticker order by [date]) as next_open
into #bars
from
dbo.HA_Dataset
where
ticker_set = @ticker_set
and
bar_period = @bar_period;
-- layer 2
(saved in #exits): exit signals; run_start_date is the first
-- red bar of the run, and the trade
exits at the next day's open
-- 1 red: red, preceded by green
-- 2 reds: red, preceded by red,
preceded by green
drop table if
exists #exits;
select
ticker,
case when
@exit_reds = 1 then [date] else prev_date end as run_start_date,
[date] as exit_signal_date,
next_date
as exit_date,
next_open
as exit_price
into #exits
from #bars
where
(@exit_reds = 1 and ha_color = 'red' and color_1_back = 'green')
or
(@exit_reds = 2 and ha_color = 'red' and color_1_back = 'red'
and color_2_back = 'green');
-- index for
the exit lookup in layer 4
create
clustered index ix_exits on #exits (ticker, run_start_date);
with
-- layer 3:
entry signals; the trade enters at the next trading day's open
-- 1 green: green, preceded by red
-- 2 greens: green, preceded by green,
preceded by red
entry_signals
as
(
select
ticker,
next_date as entry_date,
next_open as entry_price
from #bars
where
next_date is not null
and (
(@entry_greens = 1 and ha_color = 'green' and color_1_back = 'red')
or
(@entry_greens = 2 and ha_color = 'green' and color_1_back = 'green'
and
color_2_back = 'red')
)
),
-- layer 4:
pair each entry with the first exit signal for the same ticker
-- whose red run starts on or after the
entry date
paired as
(
select
e.ticker,
e.entry_date,
e.entry_price,
x.exit_signal_date,
x.exit_date,
x.exit_price
from
entry_signals e
outer apply
(
select
top 1 xs.exit_signal_date, xs.exit_date, xs.exit_price
from
#exits xs
where
xs.ticker = e.ticker
and
xs.run_start_date >= e.entry_date
order
by xs.run_start_date
) x
where
e.entry_date >= @start_date
),
-- layer 5:
entries that occur while a trade is still open share that
-- trade's exit; keep only the earliest
entry for each exit
-- (a trade still open at the end of the
data has a null exit)
trades as
(
select
ticker,
entry_date, entry_price, exit_date, exit_price,
row_number() over (partition by ticker, exit_signal_date
order by
entry_date) as entry_order
from paired
),
-- layer 6:
percent return for each trade
priced as
(
select
ticker,
entry_date,
entry_price,
exit_date,
exit_price,
cast((exit_price - entry_price) / entry_price * 100 as decimal(18,4)) as
trade_pct
from trades
where
entry_order = 1
)
-- final layer:
add the cumulative percent return within each ticker
-- and save the
trades tagged with the ticker set, bar period, and configuration
insert into
dbo.HA_Confirm_Trades
(ticker_set, bar_period, entry_greens, exit_reds, ticker,
entry_date, entry_price, exit_date, exit_price, trade_pct, cum_pct)
select
@ticker_set,
@bar_period,
@entry_greens,
@exit_reds,
ticker,
entry_date,
entry_price,
exit_date,
exit_price,
trade_pct,
cast(sum(trade_pct) over (partition by ticker order by entry_date
rows
unbounded preceding) as decimal(18,4)) as cum_pct
from priced
option
(recompile);
-- mark this
run as done
delete from
#runs
where
ticker_set = @ticker_set
and
entry_greens = @entry_greens
and
exit_reds = @exit_reds;
end;
drop table if exists #bars;
drop table if exists #exits;
---------------------------------------------------------
-- 3. check: the 1-green / 1-red configuration should
match the prior post's
--
follow-the-trend results (ticker, trades, model_net_pct)
---------------------------------------------------------
select
ticker_set,
ticker,
count(trade_pct)
as trades,
cast(sum(trade_pct) as decimal(10,2)) as model_net_pct
from dbo.HA_Confirm_Trades
where bar_period
= @bar_period
and entry_greens
= 1
and
exit_reds = 1
group by ticker_set, ticker
order by ticker_set, case when ticker = 'SPY' then 1 else
0 end, ticker;
---------------------------------------------------------
-- 4. summary by ticker and configuration: trades and
model net change
---------------------------------------------------------
select
ticker_set,
ticker,
entry_greens,
exit_reds,
count(trade_pct)
as trades,
cast(sum(trade_pct) as decimal(10,2)) as model_net_pct
from dbo.HA_Confirm_Trades
where bar_period = @bar_period
group by ticker_set, ticker, entry_greens, exit_reds
order by ticker_set, case when ticker = 'SPY' then 1 else
0 end, ticker,
entry_greens, exit_reds;
Confirming the Results in dbo.HA_Confirm_Trades
In the preceding script, dbo.HA_Confirm_Trades is created in section 1 if it does not already exist and populated with individual trades in section 2. Section 4 summarizes those trades as the count of closed trades and net percent change for every ticker in both ticker sets under each of the four configurations.
Because two of the tickers (MSFT and NVDA) reside in each of the two ticker sets, the script for this section reports closed trades and net percent change for just the thirteen unique tickers across the original fifteen tickers in both ticker sets.
Here is the full script listing for this section. The listing starts with a brief summary of the script that highlights its role.
This script has two layers. The first layer is a CTE. This code segment in the following image is from the first layer. It removes duplicate ticker instances by retaining a row from Long_term6_for_HA only if its ticker doesn’t also appear in First_HA_Ticker_Set.
The second layer reshapes the CTE’s rows into one row per ticker, saves its result set as dbo.HA_Confirm_Ticker_Results, and the final select statement displays that table. There are three column sets after the column of ticker values.
- The first set is comprised of a single column named source_ticker_set, which indicates the source ticker set for each ticker in the result set.
- The second set consists of four columns named net_1g1r through net_2g2r. Each of these columns displays net percent change of one of the four model configurations. For example,
- The column name net_1g1r contains net percent change values from the follow-the-trend model configuration, which has a start trade signal of one green bar following a red bar and an end trade signal of one red bar following a green bar.
- The column name net_2g2r contains net percent change values from the follow-the-trend model configuration, which has a start trade signal of two green bars following a red bar and an end trade signal of two red bars following a green bar.
- The third set also consists of four columns named trades_1g1r through trades_2g2r. These four columns report trade count by ticker for each of the four model configurations.
use securitytradinganalytics;
go
declare @bar_period char(1) = 'D';
---------------------------------------------------------
-- 1. ticker-level results: one row per unique ticker
---------------------------------------------------------
drop table if exists dbo.HA_Confirm_Ticker_Results;
with
-- layer 1: closed trades and net % change by ticker and
configuration;
-- tickers
in both sets are taken from First_HA_Ticker_Set only
ticker_cells as
(
select
t.ticker_set,
t.ticker,
t.entry_greens,
t.exit_reds,
count(t.trade_pct)
as trades,
cast(sum(t.trade_pct) as decimal(10,2)) as net_pct
from
dbo.HA_Confirm_Trades t
where
t.bar_period = @bar_period
and (
t.ticker_set = 'First_HA_Ticker_Set'
or
(t.ticker_set = 'Long_term6_for_HA'
and
not exists (select 1
from
dbo.HA_Confirm_Trades f
where f.ticker_set
= 'First_HA_Ticker_Set'
and f.bar_period
= @bar_period
and
f.ticker = t.ticker))
)
group by
t.ticker_set, t.ticker, t.entry_greens, t.exit_reds
)
-- layer 2: one row per ticker with a column for each
configuration
select
ticker,
ticker_set as
source_ticker_set,
max(case when
entry_greens = 1 and exit_reds = 1 then net_pct end) as net_1g1r,
max(case when
entry_greens = 1 and exit_reds = 2 then net_pct end) as net_1g2r,
max(case when
entry_greens = 2 and exit_reds = 1 then net_pct end) as net_2g1r,
max(case when
entry_greens = 2 and exit_reds = 2 then net_pct end) as net_2g2r,
max(case when
entry_greens = 1 and exit_reds = 1 then trades
end) as trades_1g1r,
max(case when
entry_greens = 1 and exit_reds = 2 then trades
end) as trades_1g2r,
max(case when
entry_greens = 2 and exit_reds = 1 then trades
end) as trades_2g1r,
max(case when
entry_greens = 2 and exit_reds = 2 then trades
end) as trades_2g2r
into dbo.HA_Confirm_Ticker_Results
from ticker_cells
group by ticker, ticker_set;
alter table dbo.HA_Confirm_Ticker_Results
alter column
ticker varchar(20) not null;
alter table dbo.HA_Confirm_Ticker_Results
add constraint
pk_HA_Confirm_Ticker_Results primary key (ticker);
-- show the ticker-level table (spy last); copy this
result set to Excel
select *
from dbo.HA_Confirm_Ticker_Results
order by case when ticker = 'SPY' then 1 else 0 end,
ticker;
Here is an image of the result set from the final select statement.
- Rows are identified by the first two column values.
- The next four columns display the ticker net percent change per model configuration.
- The last four columns display the trade count per model configuration.
The result set values are analyzed with an Excel workbook below to make the final analysis steps easier to follow.
The following worksheet contains the result values from the preceding CTE along with additional row sets for assessing
- the net percent change and trade count values across tickers as well as
- the statistical significance of main entry and exit effects across model configurations based on net percent change values.
Rows 1 through 14 are copied with column headings directly from the result set in SQL Server Management Studio directly to the Worksheet below. Row 16 shows the average net percent change across tickers and average trade count across tickers. Background cell colors are red or green.
- Cells D16 and F16 with green cell backgrounds are for the two model configurations with a trade close signal of two red bars.
- Cells C16 and E16 with red cell backgrounds are for the two model configurations with a trade close signal of one red bar.
- As you can see, the average net percent change is larger when the model configuration ends trades with two red bars than with one red bar.
- A similar kind of pattern is evident for the trade counts. Configurations that end with two red bars require around either 60 or 100 fewer trades.
Some readers may be wondering if the trends for the entry and exit effects are statistically significant or just chance outcomes. For that reason, we close this section with two one-sided t tests –– one for entry effect and the exit effect. The calculated t values appear in cells F19 and F20. The critical t values at the .05 level appear in cells H19 and H20. In the context of this post, the entry effect reveals whether it makes a difference if you configure your trade entry based a signal with 1 or 2 green bars, and the exit effect confirms at the .05 level whether it makes a difference whether you configure trades with 1 or 2 red bars.
- Because the calculated t in cell F20 is greater than the critical t value in cell H20, using a trade exit signal based on two red bars leads to better performance than using a trade based on one red bar.
- In contrast, because the calculated t in cell F19 is not greater than the critical t value in cell H19, it does not matter if you use a trade entry signal of one or two green bars.
- The expressions in cells D19, E19, and F19 are, respectively:
- =((E16+F16)-(C16+D16))/2
- =STDEV.S(((E2:E14+F2:F14)-(C2:C14+D2:D14))/2)
- =D19/(E19/SQRT(13))
- The expressions in cells D20, E20, and F20 are, respectively:
- =((D16+F16)-(C16+E16))/2
- =STDEV.S(((D2:D14+F2:F14)-(C2:C14+E2:E14))/2)
- =D20/(E20/SQRT(13))
Concluding Comments
This post examined whether requiring confirmation days improves a Heikin Ashi follow-the-trend model. Four configurations were backtested on thirteen unique tickers, combining an entry signal of one or two green bars with an exit signal of one or two red bars. The 1-green/1-red configuration reproduced the results from the second post, which confirms the modified backtest logic.
The main findings are:
- Exit effect: configurations that end a trade with two red bars had a higher average net percent change than those that exit on one red bar. The calculated t value exceeded the .05 critical value, so the difference is statistically significant.
- Entry effect: the calculated t value did not exceed the critical value, so requiring two green bars did not improve performance.
- Trade counts: configurations with a two-red-bar exit also generated noticeably fewer trades, so the exit confirmation improves results with less trading activity.
Two cautions apply. The tests rest on thirteen tickers over a single ten-year window, and the results reflect net percent change before transaction costs and slippage. Treat the findings as evidence for this ticker sample, not as a guarantee for other tickers or periods.
Because the entry confirmation adds nothing measurable, the simpler one-green-bar entry looks sufficient. A two-red-bar exit looks worth keeping. Later posts in this series can build on this by testing further refinements to the model. You are encouraged to leave a comment about further refinements that most merit additional testing.





Comments
Post a Comment