本帖最后由 技术009 于 2022-10-9 09:01 编辑
[PEL] 复制代码
Unit:=1;
Diff := rounds( ema( close,12 )-ema( close,26 ),2 ) ;
Dea := rounds( ema( diff,9 ),2 ) ;
Macd := 2*( diff-dea ), colorstick;
lk:=0;
mark:=0;
// 出 场
if holding > 0 and ref( cross( dea,diff ),1 ) then
begin
if OPENPROFITPER<=-2 then mark:=-1;
sell( holding > 0,holding,limitr, open - 1 * mindiff ),ignorecheckprice ;
if NUMPROFIT(1)<0 and NUMPROFIT(2)<0 then lk:=1;
end
if holding < 0 and ref( cross( diff,dea ),1 ) then
begin
if OPENPROFITPER<=-2 then mark:=-1;
sellshort( holding < 0,holding,limitr, open + 1 * mindiff ),ignorecheckprice ;
if NUMPROFIT(1)<0 and NUMPROFIT(2)<0 then lk:=1;
end
Len:BARSLAST(mark=-1); //上次亏损2%位置距离当前的周期跨度 。这个亏损是以平仓时候浮亏比例判断的,也就是满足信号时候的浮亏盈亏情况作为判断依据。
Len2:BARSLAST(lk=1);//连亏2次的平仓 距离当前的周期跨度
// 入 场
if holding = 0 and ref( cross( diff,dea ),1 ) and (Len>9 or VALID(Len)=0) and (Len2>9 or VALID(Len2)=0) then buy( 1,Unit,limitr, open + 1 * mindiff ),ignorecheckprice ;
if holding = 0 and ref( cross( dea,diff ),1 ) and (Len>9 or VALID(Len)=0) and (Len2>9 or VALID(Len2)=0) then buyshort( 1,Unit,limitr, open - 1 * mindiff ),ignorecheckprice ;
|