我使用EMA交叉作为信号,但是触发的交易没有跨界
我使用EMA交叉作为信号,但是以不发生跨界的价格触发的交易... 您的帮助将不胜感激。谢谢你!
//@version=5
strategy(title='test', overlay=true, pyramiding=0)
fast = ta.ema(close,50)
mid = ta.ema(close,100)
slow = ta.ema(close,200)
plot(fast, color=color.white)
plot(mid, color=color.yellow)
plot(slow, color=color.red)
if (fast > mid) or (mid > slow) or (fast > slow)
strategy.entry("Long1", strategy.long, limit=close * 0.99)
if (fast > mid) and (fast > slow)
strategy.entry("Long3", strategy.long)
if fast < mid or mid < slow or fast < slow
strategy.entry("Short1", strategy.short, limit=close * 1.01)
if fast < mid and fast < slow
strategy.entry("Short3", strategy.short)
I use ema crossover as signal, however deal triggered at price where no crossover happened...
Your help will be greatly appreciated. Thank you!
//@version=5
strategy(title='test', overlay=true, pyramiding=0)
fast = ta.ema(close,50)
mid = ta.ema(close,100)
slow = ta.ema(close,200)
plot(fast, color=color.white)
plot(mid, color=color.yellow)
plot(slow, color=color.red)
if (fast > mid) or (mid > slow) or (fast > slow)
strategy.entry("Long1", strategy.long, limit=close * 0.99)
if (fast > mid) and (fast > slow)
strategy.entry("Long3", strategy.long)
if fast < mid or mid < slow or fast < slow
strategy.entry("Short1", strategy.short, limit=close * 1.01)
if fast < mid and fast < slow
strategy.entry("Short3", strategy.short)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不使用跨界/横求功能而代替比较呢?
您的代码将成为这样的东西:
Why not using Crossover/Crossunder function instead comparision?
Your code will become something like this: