Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/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,我如何制定这一策略,只做多头,平仓而不做空 非常感谢 //Noro //2019 //@版本=3 策略(title=“Noro's TrendTrader strategy v1.0”,shorttitle=“TT str”,overlay=true,default\u qty\u type=strategy.percent\u of\u equity,default\u qty\u value=100,聚合=0) //背景 len=输入(21,最小值=1) mult=输入(3,最小值=1) /

我如何制定这一策略,只做多头,平仓而不做空

非常感谢

//Noro
//2019
//@版本=3
策略(title=“Noro's TrendTrader strategy v1.0”,shorttitle=“TT str”,overlay=true,default\u qty\u type=strategy.percent\u of\u equity,default\u qty\u value=100,聚合=0)
//背景
len=输入(21,最小值=1)
mult=输入(3,最小值=1)
//线
atr=wma(atr(1),len)
最高C=最高(len)
lowestC=最低(len)
hiLimit=最高的C[1]-(atr[1]*mult)
loLimit=lowestC[1]+(atr[1]*mult)
ret=0.0
ret:=close>hiLimit和close>loLimit?hiLimit:close返回并关闭<打开
strategy.entry(“L”,strategy.long)
如果高<返回并关闭>打开
strategy.entry(“S”,strategy.short)

当满足条件(
open
)时,您的策略执行空头头寸,并自动关闭多头头寸

要长时间关闭而不执行短时间更改第39行:

strategy.entry("S", strategy.short)

strategy.close(“L”,当=高时open)

strategy.close("L", when = high < ret and close > open)