用MACD指标做罗纹模型当指标金叉开多.死叉开空.周期一分钟.金叉开多买入1手.设置止盈20个点.止损10.如止损平仓.下次开空2手设止盈20止损10.一直等有盈利20点平仓出局.下次又重开仓1手.(毎次止损平仓加倍反向买入)(每次止盈出局又重新按MACD金叉及死叉开多空仓1手) |
VARIABLE:n=0,m=0,ks=1,ds=1;
p:=26;
s:=12;
m:=9;
DIFF : EMA(CLOSE,S) - EMA(CLOSE,P);
DEA : EMA(DIFF,M);
MACD1 : 2*(DIFF-DEA),COLORSTICK;
jc:cross(diff,dea);
sc:cross(dea,diff);
if jc and holding=0 then begin
buy(1,ds,market);
end
if h-enterprice>=20 and enterbars>0 then begin
sell(holding>0,holding,market);//多盈
n:=0;
end
if n=0 then ks:=1;
if enterprice-l>=10 and enterbars>0 then begin //多损
sell(holding>0,holding,market);
n:=1;
end
if n=1 then ks:=2;
if sc then begin
buyshort(holding=0,ks,market);
end
if enterprice-l>=20 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空赢
m:=0;
end
if m=0 then ds:=1;
if h-enterprice>=10 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空损
m:=1;
end
if m=1 then ds:=2;
VARIABLE:n=0,m=0,ks=1,ds=1;
p:=26;
s:=12;
m:=9;
DIFF : EMA(CLOSE,S) - EMA(CLOSE,P);
DEA : EMA(DIFF,M);
MACD1 : 2*(DIFF-DEA),COLORSTICK;
jc:cross(diff,dea);
sc:cross(dea,diff);
if jc and holding=0 then begin
buy(1,ds,market);
end
if h-enterprice>=20 and enterbars>0 then begin
sell(holding>0,holding,market);//多盈
n:=0;
end
if n=0 then ks:=1;
if enterprice-l>=10 and enterbars>0 then begin //多损
sell(holding>0,holding,market);
n:=1;
end
if n=1 then ks:=2;
if sc then begin
buyshort(holding=0,ks,market);
end
if enterprice-l>=20 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空赢
m:=0;
end
if m=0 then ds:=1;
if h-enterprice>=10 and enterbars>0 then begin
sellshort(holding<0,holding,market);//空损
m:=1;
end
if m=1 then ds:=2;