等级: 超级版主
- 注册:
- 2021-5-24
- 曾用名:
|
// 多头入场
IF HOLDING <> 1 AND REF(C,1)>MA1 AND REF(UPBAND,1) AND REF(CLOSE,1) > REF(UPAVG,1) THEN BEGIN
sell(holding>0,0,market); //买平空单
Buyshort(holding=0,Lots,market); //买开多单
LOWERAFTERENTRY:=LOW;
END
// 空头入场
IF HOLDING <> -1 AND REF(C,1)<MA1 AND REF(DOWNBAND,1) AND REF(CLOSE,1) < REF(LOWAVG,1) THEN BEGIN
sellshort(holding<0,0,market); //卖平多单
buy(holding=0,Lots,MARKET);//卖开空单
HIGHERAFTERENTRY:=HIGH;
END
//------------------------------------------------------------------------------------------------
//记录入场后的最高价和最低价
//------------------------------------------------------------------------------------------------
LowerAfterEntryss:= REF(LowerAfterEntry,1);
HigherAfterEntryss:=REF(HigherAfterEntry,1);
Closelp:=REF(Close,1);
If HOLDING >0 and ENTERBARS = 0 Then BEGIN
LowerAfterEntry:=Max(LowerAfterEntry,Low);
HigherAfterEntry:=HigherAfterEntryss;
end
if HOLDING <0 and ENTERBARS = 0 Then BEGIN
HigherAfterEntry:=Min(HigherAfterEntry,HIGH);
LowerAfterEntry:=LowerAfterEntryss;
end
if HOLDING <> 0 and ENTERBARS >= 1 Then BEGIN
LowerAfterEntry:=Max(LowerAfterEntryss,Low);
HigherAfterEntry:=Min(HigherAfterEntryss,HIGH);
End |
|