// 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)当我运行这段代码时,这条消息是打印“添加到图表中的脚本研究”,但是没有发生在图表上。
发布于 2022-07-08 07:49:00
在行下面似乎有一个额外的逗号。
plot (ema1, title = "EMA20", color = color.blue,)https://stackoverflow.com/questions/72900745
复制相似问题