breizh29

Heikin-Ashi Strategy V1 by breizh29

2953浏览
424
2953 10

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.
从常用的脚本中删除 添加到常用的脚本
//@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)



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.
+3 回复
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 回复
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
+2 回复
Works in any timeframe ?
works only wiht usdjpy ? Stocks?
回复
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.
回复
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 网站规则 版主 网站 & 经纪商解决方案 插件 图表解决方案 寻求帮助 功能请求 博客 & 新闻 常见问题 维基百科 Twitter
概述 个人资料设置 账号和账单 TradingView代币 我的客服工单 寻求帮助 已发表观点 粉丝 正在关注 私人消息 聊天 退出