无法使 Pinescript 策略起作用,显示“无数据”

时间:2021-06-16 23:55:59

标签: quantmod

我试图创建我的第一个策略,当我的快速 EMA 超过我的慢速 EMA 并且我的多头随机指标高于 80 水平而慢速 EMA 低于 20 水平时,该策略将买入。止损为 500 点,止盈为 2100。但是,每次进入策略测试器时,它都显示没有数据或错误数据。任何帮助将不胜感激!

''' 策略(“你真的觉得自己在真正的宗教中飞翔吗”,货币=货币.美元,叠加 = 真)

//EMA Set Up
slow = input(title="Slow EMA Length", type=input.integer, defval=50)
fast = input(title = "Fast EMA Length", type=input.integer, defval=4)
fastema = ema(close, fast)
slowema = ema(close, slow)

//Stoch Set up
length1 = 4
length2 = 50
smoothk1 = 21
smoothd = 3
kfast1 = stoch(close, high, low, 4)
dslow1 = sma(kfast1, smoothd)
kfast2 = stoch(close, high, low, 50)
dslow2 = sma(kfast2, smoothd)
// Strategy
Bullish = fastema > slowema
Bearish = fastema < slowema
longentry = kfast1 >= 20 and kfast2 <= 80


//Entries
longcondition = Bullish and longentry
if(longcondition) 
    strategy.entry("Takeoff", strategy.long)
    strategy.exit("Takeoff",stop=500,profit=2100)
else
    strategy.cancel(id="Takeoff")

//plots
plot(fastema, color=color.blue)
plot(slowema, color=color.green)

'''

0 个答案:

没有答案