Pine script 无法调用';战略.秩序';带参数(id=文字字符串,stop=series[float]);

Pine script 无法调用';战略.秩序';带参数(id=文字字符串,stop=series[float]);,pine-script,Pine Script,我试图将尾随止损纳入策略,为此我使用了多个策略。退出 但它不起作用,所以我把策略.顺序放进去,但我一次又一次地遇到同样的错误 错误: 第100行:无法使用参数(id=literal字符串,stop=series[float])调用“strategy.order”;可用重载:strategy.order(系列[string],系列[bool],系列[float],系列[float],系列[float],系列[string],常量字符串,系列[string],系列[bool],系列[string])

我试图将尾随止损纳入策略,为此我使用了多个
策略。退出

但它不起作用,所以我把
策略.顺序
放进去,但我一次又一次地遇到同样的错误
错误:
第100行:无法使用参数(id=literal字符串,stop=series[float])调用“strategy.order”;可用重载:strategy.order(系列[string],系列[bool],系列[float],系列[float],系列[float],系列[string],常量字符串,系列[string],系列[bool],系列[string])=>void

请帮我把拖尾sl放进sctipt

脚本
//@版本=4 策略(“样本战略”,叠加=真)

//反向测试时间周期的规则------------------------------------------------
开始日期=输入(title=“开始日期”,type=input.integer,
defval=1,minval=1,maxval=31)
开始月份=输入(title=“开始月份”,type=input.integer,
defval=1,minval=1,maxval=12)
startYear=input(title=“起始年”,type=input.integer,
defval=2018,minval=1800,maxval=2100)
endDate=input(title=“End Date”,type=input.integer,
defval=1,minval=1,maxval=31)
endMonth=input(title=“End Month”,type=input.integer,
defval=7,minval=1,maxval=12)
endYear=input(title=“End Year”,type=input.integer,
defval=2020,minval=1800,maxval=2100)
//加载期间结束的回测时间规则---------------------------------------------
inDateRange=(时间>=时间戳,
开始月份,开始日期,0,0)和
(时间<时间戳(syminfo.timezone,endYear,endMonth,endDate,0,0))
ema=input(title=“Small ema”,type=input.integer,
defval=20)
ema2=input(title=“Big Ema”,type=input.integer,
defval=150)
sma20=均线(闭合,均线)
sma50=均线(闭合,均线2)
长=sma20>sma50
短=sma200)
stopValue=close*(1-longTrailPerc)
最大值(stopValue,longStopPrice2[1])
其他的
0
//确定尾随空头价格
shortStopPrice2=0.0
shortStopPrice2:=如果(策略位置大小<0)
stopValue=close*(1+shortTrailPerc)
最小值(stopValue,ShortStopRice2[1])
其他的
999999
如果时间>=开始和时间0)
策略.退出(id=“XL STP”,停止=longStopPrice)
如果(价格2)
策略.订单(id=“TL SL”,stop=longStopPrice2)
如果(策略位置大小<0)
退出(id=“XS STP”,stop=shortStopPrice)
if(短路故障2)
策略.顺序(id=“TL SL”,stop=shortStopPrice2)
策略。收盘(“买入”,当=空头)
策略.收盘(“卖出”,当=多头)
绘图(sma20,title=“fast”,color=color.green,线宽=2)
绘图(sma50,title=“Slow”,color=color.red)
我尝试了这么久,但我找不到任何解决方案,请帮助我解决这个错误


谢谢

请参阅参考手册:

strategy.order(id, long, qty, limit, stop, oca_name, oca_type, comment, when, alert_message) → void
long
是strategy.order调用的必需参数。 订单方向:“真”或“策略。多头”表示买入,“假”或“策略。空头”表示卖出


if (strategy.position_size > 0)
    strategy.exit(id="XL STP", stop=longStopPrice)
    if(longStopPrice2)
        strategy.order(id="TL SL", long = true, stop=longStopPrice2)

if (strategy.position_size < 0)
    strategy.exit(id="XS STP", stop=shortStopPrice)
    if(shortStopPrice2)
        strategy.order(id="TL SL", long = true, stop=shortStopPrice2)

如果(策略位置大小>0)
策略.退出(id=“XL STP”,停止=longStopPrice)
如果(价格2)
strategy.order(id=“TL SL”,long=true,stop=longStopPrice2)
如果(策略位置大小<0)
退出(id=“XS STP”,stop=shortStopPrice)
if(短路故障2)
strategy.order(id=“TL SL”,long=true,stop=shortStopPrice2)

if (strategy.position_size > 0)
    strategy.exit(id="XL STP", stop=longStopPrice)
    if(longStopPrice2)
        strategy.order(id="TL SL", long = true, stop=longStopPrice2)

if (strategy.position_size < 0)
    strategy.exit(id="XS STP", stop=shortStopPrice)
    if(shortStopPrice2)
        strategy.order(id="TL SL", long = true, stop=shortStopPrice2)