Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pine script 如何在学习松树剧本的策略中使用情节_Pine Script - Fatal编程技术网

Pine script 如何在学习松树剧本的策略中使用情节

Pine script 如何在学习松树剧本的策略中使用情节,pine-script,Pine Script,我有这个策略脚本,我会把它转换成一个学习脚本 //@version=4 strategy("SSL Channel Cross", overlay=true) period=input(title="Period", defval=10) len=input(title="Period", defval=10) // From Date Inputs fromDay = input(defval=16, title="From

我有这个策略脚本,我会把它转换成一个学习脚本

//@version=4
strategy("SSL Channel Cross", overlay=true)
period=input(title="Period", defval=10)
len=input(title="Period", defval=10)
// From Date Inputs
fromDay = input(defval=16, title="From Day", minval=1, maxval=31)
fromMonth = input(defval=2, title="From Month", minval=1, maxval=12)
fromYear = input(defval=2021, title="From Year", minval=1970)
// To Date Inputs
toDay = input(defval=17, title="To Day", minval=1, maxval=31)
toMonth = input(defval=2, title="To Month", minval=1, maxval=12)
toYear = input(defval=2021, title="To Year", minval=1970)
// Calculate start/end date and time condition
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = time >= startDate and time <= finishDate

smaHigh=sma(high, len)
smaLow=sma(low, len)
Hlv = 0
Hlv := close > smaHigh ? 1 : close < smaLow ? -1 : Hlv[1]
sslDown = Hlv < 0 ? smaHigh: smaLow
sslUp   = Hlv < 0 ? smaLow : smaHigh
    
plot(sslDown, linewidth=2, color=color.red)
plot(sslUp, linewidth=2, color=color.lime)
    
longCondition = crossover(sslUp, sslDown)
shortCondition = crossunder(sslUp, sslDown)
    
if (longCondition)
    strategy.close("Short", strategy.long, when=time_cond)
    strategy.entry("Long", strategy.long, when=time_cond)
        
if (shortCondition)
    strategy.close("Long", strategy.long, when=time_cond)
    strategy.entry("Short", strategy.short, when=time_cond)
显示输入/输出长文本或标签以及显示输入/输出短文本或标签

我试着用

  plotchar(time_cond,char='SHORT')
  plotchar(longCondition,char='SHORT')

但我总是收到一个错误。哪种方法正确?

如果要输出文本,请尝试此选项

plotshape(longCondition and time_cond, text='Long')

如果要输出文本,请尝试此选项

plotshape(longCondition and time_cond, text='Long')