熊市操盘线
(参数:N1=6; M=55; Q=23; N=34; P=2 ; R=26;)
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)),LINETHICK2,COLORFF00FF;
FS:MA(DX,17)+MA(DX,17)-REF(MA(DX,17),1),LINETHICK2,COLORFF00FF;
搏杀线:=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;
MID:=IF (CLOSE>MA(CLOSE,m),MA(HIGH,q),MA(LOW,n));
UP:MID+P*STD(CLOSE,r);
dn:MID-P*STD(CLOSE,r);
IsNowBuy:=FALSE;
sBUY:=CROSS(LOW[1],dn) AND (up-dn)/dn>0.3 AND CLOSE<MID AND (CLOSE-CLOSE[1])/CLOSE[1]<0.03 AND IsNowBuy[1]==FALSE; //买入信号
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(熊市数值);
|