H1 := ref(HHV(High,Length),1);
L1 := ref(LLV(Low,Length),1);
VARIABLE:BreakUnderCounter = 0 ;
VARIABLE:BreakUnderCounter = 0 ;
if High > H1 then Begin
BreakoutCounter := 1 ;
BreakUnderCounter := 0 ;
end;
if Low < L1 then Begin
BreakUnderCounter := 1 ;
BreakOutCounter := 0 ;
end;
if BreakOutCounter >= BrkOutNo then Begin
Buy(holding=0,1,market);
BreakOutCounter = 1 ;
end;
if BreakUnderCounter >= BrkOutNo then Begin
buyshort(holding=0,1,market);
BreakUnderCounter = 1 ;
end;
if c< LlV(Low,TrailLen) then begin
sell(holding>0,0,market);
end;
if c>hhv(high,TrailLen) then begin
sellshort(holding<0,0,market);
end;
资产:asset,noaxis,COLORGRAY;
改成这样
if High > H1 then Begin
BreakoutCounter := BreakoutCounter +1 ;
BreakUnderCounter := 0 ;
end;
if Low < L1 then Begin
BreakUnderCounter := BreakUnderCounter+1 ;
BreakOutCounter := 0 ;
end;
if BreakOutCounter >= BrkOutNo then Begin
Buy(holding=0,1,market);
BreakOutCounter := 1 ;
end;
if BreakUnderCounter >= BrkOutNo then Begin
buyshort(holding=0,1,market);
BreakUnderCounter := 1 ;
end;