求助高手,编写一个通达信K线头肩底选股公式
2017-08-22
展开全部
D:=15;FIRE:=3;
MACD:=BARSLAST("MACD.MACD"<REF("MACD.MACD",1))>=3;
A:=ZIG(4,D); B:=REF(A,1);
G:=CROSS(A,B); F:=CROSS(B,A);
VAR1:=REF(LOW,SUMBARS(G,3)); {左肩起涨低价}
VAR2:=REF(HIGH,SUMBARS(F,2)); {左肩最高价}
VAR3:=REF(HIGH,SUMBARS(F,1)); {右肩最高价}
VAR4:=REF(LOW,SUMBARS(G,2)); {头肩底价}
VAR5:=REF(LOW,SUMBARS(G,1)); {右肩回调低价}
买点1:=IF(VAR3>1.01*VAR2 AND VAR5>1.01*VAR1 AND VAR4<VAR1 AND BARSLAST(G)<3 AND MACD,1,0);
买点2:=IF(VAR3>1.01*VAR2 AND VAR5>1.01*VAR1 AND VAR4<VAR1 AND CROSS(CLOSE,VAR2),2,0);
买点3:=IF(VAR3>1.01*VAR2 AND VAR5>1.01*VAR1 AND VAR4<VAR1 AND CROSS(CLOSE,VAR3),3,0);
CHOICE:IF(FIRE=1,买点1,IF(FIRE=2,买点2,买点3));
MACD:=BARSLAST("MACD.MACD"<REF("MACD.MACD",1))>=3;
A:=ZIG(4,D); B:=REF(A,1);
G:=CROSS(A,B); F:=CROSS(B,A);
VAR1:=REF(LOW,SUMBARS(G,3)); {左肩起涨低价}
VAR2:=REF(HIGH,SUMBARS(F,2)); {左肩最高价}
VAR3:=REF(HIGH,SUMBARS(F,1)); {右肩最高价}
VAR4:=REF(LOW,SUMBARS(G,2)); {头肩底价}
VAR5:=REF(LOW,SUMBARS(G,1)); {右肩回调低价}
买点1:=IF(VAR3>1.01*VAR2 AND VAR5>1.01*VAR1 AND VAR4<VAR1 AND BARSLAST(G)<3 AND MACD,1,0);
买点2:=IF(VAR3>1.01*VAR2 AND VAR5>1.01*VAR1 AND VAR4<VAR1 AND CROSS(CLOSE,VAR2),2,0);
买点3:=IF(VAR3>1.01*VAR2 AND VAR5>1.01*VAR1 AND VAR4<VAR1 AND CROSS(CLOSE,VAR3),3,0);
CHOICE:IF(FIRE=1,买点1,IF(FIRE=2,买点2,买点3));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询