当我运行此代码时,图表中什么都没发生

发布于 2025-02-13 16:26:45 字数 917 浏览 1 评论 0原文

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jithuldevaraj01

//@version=5

strategy ("VRD's MA Crossover Strategy v1", overlay = true)
start = timestamp (2007, 1,1,0,0)
end = timestamp (2021,6,1,0,0)
ema1 = ta.ema(close, 20)
ema2 = ta.ema(close, 50)
plot (ema1, title = "EMA20", color = color.blue,)
plot (ema2, title = "EMA50", color = color.green)

//strategy
LongEntry = ta.crossover (ema1, ema2)
LongExit = ta.crossover (ema2, ema1)
ShortEntry = ta.crossover (ema2, ema1)
ShortExit = ta.crossover (ema1, ema2)

if time >= start and time < end
    strategy.entry ("Long", strategy.long, 1, when = LongEntry)
    strategy.close ("Long", when = LongExit)
    strategy.entry ("Short", strategy.short, 1, when = ShortEntry)
    strategy.close ("Short", when = ShortExit)

当我运行此代码时,此消息是打印“添加到图表中的脚本研究”,但图表上正在发生。

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jithuldevaraj01

//@version=5

strategy ("VRD's MA Crossover Strategy v1", overlay = true)
start = timestamp (2007, 1,1,0,0)
end = timestamp (2021,6,1,0,0)
ema1 = ta.ema(close, 20)
ema2 = ta.ema(close, 50)
plot (ema1, title = "EMA20", color = color.blue,)
plot (ema2, title = "EMA50", color = color.green)

//strategy
LongEntry = ta.crossover (ema1, ema2)
LongExit = ta.crossover (ema2, ema1)
ShortEntry = ta.crossover (ema2, ema1)
ShortExit = ta.crossover (ema1, ema2)

if time >= start and time < end
    strategy.entry ("Long", strategy.long, 1, when = LongEntry)
    strategy.close ("Long", when = LongExit)
    strategy.entry ("Short", strategy.short, 1, when = ShortEntry)
    strategy.close ("Short", when = ShortExit)

when i run this code this message is printing "Script study added to the chart" but nothin is happening on the chart

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无所谓啦 2025-02-20 16:26:46

下线似乎有一个额外的逗号

plot (ema1, title = "EMA20", color = color.blue,)

There appears to be an extra comma in below line

plot (ema1, title = "EMA20", color = color.blue,)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文