|
- 1 runmode:0;
- 2
- 3 input:period1(4,1,100,1);
- 4 input:period2(9,1,100,1);
- 5 input:period3(18,1,100,1);
- 6
- 7 variable:myasset=30000;
- 8
- 9 entertime:=time>=092500 and time<=145500;
- 10 exittime:=time>=150000;
- 11
- 12 ma1:=ma(close,period1);
- 13 ma2:=ma(close,period2);
- 14 ma3:=ma(close,period3);
- 15
- 16 buycond:=entertime and ref(close>ma1 and ma1>ma2 and ma2>ma3,1);
- 17 buyprice:=open;
- 18
- 19 buyshortcond:=entertime and ref(close<ma1 and ma1<ma2 and ma2<ma3,1);
- 20 buyshortprice:=open;
- 21
- 22 if holding=0 and buycond then begin
- 23 buy(1,1,limitr,buyprice);
- 24 end
- 25
- 26 if holding=0 and buyshortcond then begin
- 27 buyshort(1,1,limitr,buyshortprice);
- 28 end
- 29
- 30 if holding>0 and exittime then begin
- 31 sell(1,holding,limitr,close);
- 32 end
- 33
- 34 if holding<0 and exittime then begin
- 35 sellshort(1,holding,limitr,close);
- 36 end
- 37
- 38 if exittime then
- 39 myasset:=asset;
- 40
- 41 资产:myasset,noaxis,colormagenta;
- 42 次数:totaltrade,linethick0;
- 43 收益:(myasset-30000)/30000,linethick0;
- 44 胜率:percentwin,linethick0;
- 45 出击:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
- 46 连亏:maxseqloss,linethick0;
- 47 连赢:maxseqwin,linethick0;
- 48
复制代码
|
|