這個是經典的突破策略,我自己的原始設計是 Range>Highest(Range,500)[1],用這個來捕捉大波動
{Big Volatility}
Inputs:Stdev(2),Length(55),ProfitPt(0);
Vars:CloseToClose(0),CTCStdDev(0),RangeStdv(0),BigVolatility(False),MP(0);
CloseToClose=AbsValue(Close-Close[1]);
CTCStdDev=Average(CloseToClose,Length)+StdDev(CloseToClose,Length)*Stdev;
RangeStdv=Average(Range,Length)+StdDev(Range,Length)*Stdev;
BigVolatility=CloseToClose>CTCStdDev[1] or Range>RangeStdv[1];
If BigVolatility then begin
Buy next bar at Close+Average(Range,3)[1] Stop;
SellShort next bar at Close-Average(Range,3)[1] Stop;
End;
MP=MarketPosition;
If MP=1 and MP[1]=0 then StopPrice=Low-Average(Range,4);
If MP=-1 and MP[1]=0 then StopPrice=High+Average(Range,4);
If MP=1 then begin
Sell next bar at StopPrice Stop;
StopPrice = StopPrice+(Low-StopPrice)/3;
End;
If MP=-1 then begin
BuyToCover next bar at StopPrice Stop;
StopPrice = StopPrice-(StopPrice-High)/3;
End;