我正在尝试在交易视图中的 Pinescript 上运行此脚本。但是,当我尝试添加时间戳时,它不起作用。有人可以帮忙吗?
//@version=4
strategy("My Strategy", overlay=true)
start = timestamp(2007, 1, 1, 0, 0)
end = timestamp(2009, 3, 31, 0, 0)
// Indicators
SMA50 = sma(close, 50)
SMA100 = sma(close, 100)
rsi = rsi(close, 14)
atr = atr(14)
// Crossover conditions
longCondition = crossover(SMA50, SMA100)
if (longCondition)
stopLoss = low - atr * 2
takeProfit = high + atr * 6
strategy.entry("long", strategy.long, 100, when = rsi > 30)
strategy.exit ("exit", "long", stop=stopLoss, limit=takeProfit)
// Plotting SMAs in the chart.
plot(SMA50)
plot(SMA100,color=color.black)