程式碼分析.18

2022/01/05閱讀時間約 2 分鐘
波動度壓縮後,等待突破訊號,是提高勝算的好構想,
以下是內困型態發生後的突破策略程式碼
{Inside Day Breakout Failure}
Input:RngAvg(3);
Vars:DayRangeAvg(0),LongEntryPrice(1),ShortEntryPrice(-1);
Vars:InsideDay(False),PlacedOrder(False);
InsideDay = High of Data2<High[1] of Data2 and Low of Data2>Low[1] of Data2;
DayRangeAvg = Average(TrueRange of Data2,RngAvg) of Data2;
If Date[0]<>Date[1] then begin
PlacedOrder = False;
LongEntryPrice = -1;
ShortEntryPrice = -1;
End;
If InsideDay then begin
If PlacedOrder = False and Low < Low of Data2 then begin
LongEntryPrice = High of Data2;
PlacedOrder = True;
End;
If PlacedOrder = False and High > High of Data2 then begin
ShortEntryPrice = Low of Data2;
PlacedOrder = True;
End;
If PlacedOrder and LongEntryPrice<>-1 then Buy next bar at LongEntryPrice stop;
If PlacedOrder and ShortEntryPrice<>-1 then SellShort next bar at ShortEntryPrice stop;
Sell next bar at Low of Data2 - DayRangeAvg*0.5 stop;
BuyToCover next bar at High of Data2 + DayRangeAvg*0.5 stop;
為什麼會看到廣告
Piemann
Piemann
Piemann 只是一位中年大叔 !
留言0
查看全部
發表第一個留言支持創作者!