你好老师,请问下:
①,第1次开仓是赚的,下次还是开1手;(或,只要上次是赚的,就永远一手)
②,第1次开仓1手是亏的,下次开2手,如果还是亏,再下次开4手(2倍关系),最大到8手,不能开了。
③,若第1次开仓1手是亏损的,下次开仓2手,如果这2手是赚的,下次从1手重新开始。
麻烦老师,以下面为例,帮我写个。谢谢
DIFF : =EMA(CLOSE,12) - EMA(CLOSE,26);
DEA : =EMA(DIFF,8);
macd :=2*(DIFF-DEA),COLORSTICK;
aa:=diff>dea;
bb:=diff<dea;
aa,开多;
bb, 平多;
VARIABLE:ss:=1;
input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);
DIFF :EMA(CLOSE,S) - EMA(CLOSE,P);
DEA :EMA(DIFF,M);
MACD1 :2*(DIFF-DEA), COLORSTICK;
macdjc:cross(diff,dea),NODRAW;//macd金叉
macdsc:cross(dea,diff),NODRAW;
if macdjc and holding=0 then
begin
buy(1,ss,market);
end
if macdsc and holding>0 then
begin
sell(1,holding,market);
if NUMPROFIT(1)<0 and ss<8 then ss:=ss*2;
if NUMPROFIT(1)>0 then ss:=1;
end
以开多为例 供参考。