Heikin-Ashi Strategy V1 by breizh29

Here is my strategy based on Heikin-Ashi Open/Close price.
Feedbacks are welcome.
Let me know if it repaints, im not sure of this.
Remove from Favorite Scripts Add to Favorite Scripts
strategy("Heikin-Ashi Strategy V1 by breizh29",shorttitle="HAS V1",overlay=true,default_qty_value=1000,initial_capital=100000,currency=currency.EUR)
res = input(title="Resolution", type=resolution, defval="180")
hshift = input(0,title="Heikin Ashi Shift")
fama = input(2,"Heikin Ashi Close Period")
sloma = input(30,"EMA Period")
slomas = input(1,"EMA Shift")

//Heikin Ashi Open/Close Price
ha_t = heikinashi(tickerid)
ha_open = security(ha_t, res, open)
ha_close = security(ha_t, res, close[hshift])

//Moving Average
fma = sma(ha_close,fama)
sma = ema(close[slomas],sloma)

golong = crossover(ha_close,ha_open) and crossover(fma,sma)
goshort = crossunder(ha_close,ha_open) and crossunder(fma,sma)

strategy.entry("Buy",strategy.long,when = golong)
strategy.entry("Sell",strategy.short,when = goshort)

I was watching this strategy on crude oil today, and the entry signal showed up on the chart 3 hours after it triggered. For example, at 8am there was no entry shown on the chart. As soon as the 11am price bar opened, the trade entry popped up on the 8am price bar, 3 hours after the real trade location. I think this is because of the Heikin Ashi 3 hour crossover. If this is the case, then the buy signal in the chart above wouldn't show on the chart until 16:15. It works great looking back, but in real time, the signals are delayed for how long the Heikin Ashi is set to. Is there any work around to this? For testing purposes, I set an alert to get an email when the price reversed. I did get an alert just after 5am, just after 8am (the real entry), and just before 11am.
+1 Reply
joelz CaptainJohn_W
@CaptainJohn_W, Hey, did you find a fix? Running through the same issue. Wondering if there is any work around.
@joelz, I never found a solution except to use the alerts, which means I would have some false entry triggers. I do not use this strategy. If the risk per trade is kept low, then this strategy might work over the long term.
+1 Reply
joelz CaptainJohn_W
@CaptainJohn_W, I see, thank you. Will check around and see if there is another strategy that is more reliable.
It repaints. Anytime you use a higher resolution timeframe, you don't actually know the outcome until the close of that higher timeframe. Maybe it looks one way when you are watching it live but after all is said and done, it could completely change and the strategy tester is only looking back in time after the closes which you cannot know in real time.
Unfortunately, I confirm that it repaints. Just repainted on SPX500 15min charts. Is this because you are using Heikin Ashi bars instead of simple candlesticks?
breizh29 skiislife
yes its Heikin Ashi Close price which is calculatet by OHLC/4 of current bar. TradingView recalculate this price at close of the 180mn Heikin Ashi bar. Thats why its repainting.
harryli breizh29
res = input(title="Resolution", type=resolution, defval="180")
it's not TV recalculate ,its you intentionally use this to repaint
Works in any timeframe ?
works only wiht usdjpy ? Stocks?
Heiken ashi time frame must be greater then the chart timeframe. 180mn for Heiken Ashi and 15 mn for chart (standard candles) works fine.
It works fine for forex and average for stocks.
The signals are repainting sometimes, that's beceause the Heiken Ashi Close price is calculated on the fly.
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out