breizh29

Heikin-Ashi Strategy V1 by breizh29

snapshot

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
//@version=2
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)
plot(fma,title="MA",color=lime,linewidth=2,style=line)
plot(sma,title="SMA",color=red,linewidth=2,style=line)


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



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.
Reply
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?
Reply
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.
Reply
harryli PRO breizh29
res = input(title="Resolution", type=resolution, defval="180")
it's not TV recalculate ,its you intentionally use this to repaint
Reply
Works in any timeframe ?
works only wiht usdjpy ? Stocks?
Reply
breizh29 vaicru
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.
Reply
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out