牛市操盘线
 (参数:n1=6; n=90; )

DX:=(C+H+L+O)/4;
短线:((MA(DX,1)+MA(DX,3)+MA(DX,5))/3),LINETHICK2,COLORFFFFFF;
 FG:MA(DX,17)+ABS(MA(DX,17)-REF(MA(DX,17),1));
 FS:MA(DX,17)+MA(DX,17)-REF(MA(DX,17),1);
搏杀线:=IF(MA(DX,17)<FS,FS,MA(DX,17));
 FILLRGN(FG,搏杀线,搏杀线<FG,RGB(100,250,10));
 FILLRGN(搏杀线,FS,搏杀线>FS,RGB(100,250,10));
 MTM:=C-REF(C,1);
 ZLGJ:=100*EMA(EMA(MTM,N1),N1)/EMA(EMA(ABS(MTM),N1),N1);
买1:=IF(LLV(ZLGJ,2)=LLV(ZLGJ,7) AND COUNT(ZLGJ<0,2) AND CROSS(ZLGJ,MA(ZLGJ,2)),1,0);
卖1:=IF(HHV(ZLGJ,2)=HHV(ZLGJ,7) AND COUNT(ZLGJ>50,2) AND CROSS(MA(ZLGJ,2),ZLGJ),1,0);
 DRAWTEXT(FILTER(买1=1,5),LOW-0.03,"买"),colorred;
 STICKLINE(FILTER(买1=1,5),HIGH,LOW,0,1),colorred,LINETHICK3;
 DRAWTEXT(FILTER(卖1=1,1),HIGH*1.02,’卖’),COLOR00FF00;
 STICKLINE(FILTER(卖1=1,1),HIGH,LOW,0,1),COLOR00FF00,LINETHICK3;
 RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
 K:=SMA(RSV,3,1);
 D:=SMA(K,3,1);
 J:=3*K-2*D;
 BDGD:=HHV(J,2)=HHV(J,8) AND J>80;
卖2:=IF(CROSS(REF(J-0.01,1),J) AND REF(BDGD,1),1,0);
 STICKLINE(卖2 AND 卖1<>1,HIGH,LOW,2,1),coloryellow,LINETHICK3;
 STICKLINE(卖2 AND 卖1<>1,OPEN,CLOSE,4,1),coloryellow,LINETHICK3;
牛市数值=0;
 RSV=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
 a=SMA(RSV,3,1);
 b=SMA(a,3,1);
 e=3*a-2*b;
生死线:MA(CLOSE,n);
 IF(a<0) a=0;
 IF(a>100) a=100;
 IF(b<0) b=0;
 IF(b>100) b=100;
 IF(e<0) e=0;
 IF(e>100) e=100;
 IsNowBuy:=FALSE;
 sBUY:=CLOSE<1.2*LLV(LOW,7) AND CLOSE>MA(CLOSE,5) AND a>50 AND CROSS(MA(CLOSE,5),MA(CLOSE,10)); //买入信号
 IF(sBUY==1) 牛市数值=1;
 DRAWICON (sBUY,LOW,"buy");
 //判断现在是否买入状态
IF(sBuy==TRUE OR IsNowBuy[1]==TRUE)
 IsNowBuy:=TRUE;
 //
 keep=BARSLAST(sBuy == TRUE); //买入多少天了
win5=0;win10=0;win15=0;win20=0;Lose3=0;
 CanSell:=CROSS(MA(CLOSE,10),MA(CLOSE,5));
 IF(IsNowBuy==TRUE)
 {
 IF(keep > 1)
 {
 pCost = MONEY[keep-1]/VOL[keep-1];
 //5%止盈
IF(win5[1] != 1 AND HIGH/PCost>1.05 )
 {
 win5=1;
 DRAWICON(1,HIGH,"master_sell2"," 5%止盈");
牛市数值=2;
 //IsNowBuy=FALSE;
 }
 ELSE
 {
 win5=win5[1];
 }
 //10%止盈
IF(win10[1] != 1 AND HIGH/PCost>1.1 )
 {
 win10=1;
 DRAWICON(1,HIGH,"master_sell4"," 10%止盈");
牛市数值=3;
 //IsNowBuy=FALSE;
 }
 ELSE
 {
 win10=win10[1];
 }
 //15%止盈
IF(win15[1] != 1 AND HIGH/PCost>1.15 )
 {
 win15=1;
 DRAWICON(1,HIGH,"master_sell5"," 15%止盈");
牛市数值=4;
 //IsNowBuy=FALSE;
 }
 ELSE
 {
 win15=win15[1];
 }
 //5%止损
IF(Lose3[1] != 1 AND (pCost-CLOSE)/PCost>0.05)
 {
 Lose3=1;
 DRAWICON(1,HIGH,"master_sell3"," 5%止损");
牛市数值=5;
 IsNowBuy=FALSE;
 }
 ELSE
 {
 Lose3=Lose3[1];
 }
 //卖出
IF(CanSell==TRUE)
 {
 DRAWICON(1,HIGH,"master_sell1"," 均线卖出");
牛市数值=6;
 IsNowBuy=FALSE;
 }
 }
 }
 RETURN(牛市数值);
 


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。