熊市操盘线(源码)
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
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%止盈");
//IsNowBuy=FALSE;
}
ELSE
{
win5=win5[1];
}
//10%止盈
IF(win10[1] != 1 AND HIGH/PCost>1.1 )
{
win10=1;
DRAWICON(1,HIGH,"master_sell4"," 10%止盈");
//IsNowBuy=FALSE;
}
ELSE
{
win10=win10[1];
}
//15%止盈
IF(win15[1] != 1 AND HIGH/PCost>1.15 )
{
win15=1;
DRAWICON(1,HIGH,"master_sell5"," 15%止盈");
//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%止损");
IsNowBuy=FALSE;
}
ELSE
{
Lose3=Lose3[1];
}
//卖出
IF(CanSell==TRUE)
{
DRAWICON(1,HIGH,"master_sell1"," 均线卖出");
IsNowBuy=FALSE;
}
}
}
|