- 金币:
-
- 奖励:
-
- 热心:
-
- 注册时间:
- 2008-8-24
|
|
发表于 2009-2-6 16:30
|
RSV=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
a=SMA(RSV,3,1);
b=SMA(a,3,1);
IF(a< 0) a=0;
IF(a> 100) a=100;
IF(b< 0) b=0;
IF(b> 100) b=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)); //买入信号
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;
}
}
} |
|
|