区间专做多专做空策略源码
源码如下:[code]
//区间多,专做多
input:N(18,1,100,1);
开盘K线数:barslast(day<>ref(day,1))+1,linethick0;
开盘价:ref(c,开盘K线数-1),colorwhite;
上轨:开盘价+N,colorred;
long:=cross(c,上轨);
longend:=cross(开盘价,c);
if holding=0 then buy(long,1,thisclose);
if holding>0 then sell(longend,1,thisclose);
if holding>0 and enterprice-c>=20 then sell(1,1,thisclose);
if time>150500 and holding>0 then sell(1,1,thisclose);
//区间空,专做空
input:N(10,1,100,1);
开盘K线数:barslast(day<>ref(day,1))+1,linethick0;
开盘价:ref(c,开盘K线数-1),colorwhite;
下轨:开盘价-N,colorred;
short:=cross(下轨,c);
shortend:=cross(c,开盘价);
if holding=0 then buyshort(short,1,thisclose);
if holding<0 then sellshort(shortend,1,thisclose);
if time>150500 and holding<0 then sellshort(1,1,thisclose);
[/code]
页:
[1]