等级: 超级版主
- 注册:
- 2021-5-24
- 曾用名:
|
//变量定义
x:=100;
y:=50;
mid:=(x+y)/2;
a:=mid*0.99;
b:=mid*0.98;
cc:=mid*0.97;
//价格等于情况下开仓,并且只会开仓一次用holding来控制
if close=a and holding=0 then buy(1,1,marketr);
if close=b and holding=1 then buy(1,1,marketr);
if close=cc and holding=2 then buy(1,1,marketr);
//平仓条件
if close<y then sell(1,holding,marketr);
if close>mid and holding=1 then sell(1,1,marketr);
if close>a and holding=2 and holding=1 then sell(1,1,marketr);
if close>b and holding=3 and holding=1 then sell(1,1,marketr); |
|