原理图:
原理释疑:
注:取值取得是N日的值,下面的解释为说明
1. 在今天的收盘,计算两个值:最高价-收盘价,和收盘价-最低价。然后取这两个值较大的那个,乘以k值0.7。把结果称为触发值。
2. 在明天的开盘,记录开盘价,然后在价格超过(开盘+触发值)时马上买入,或者价格低于(开盘-触发值)时马上卖空。
3. 没有明确止损。这个系统是反转系统,也就是说,如果在价格超过(开盘+触发值)时手头有一口空单,则买入两口。同理,如果在价格低于(开盘-触发值)时手上有一口多单,则卖出两口。
源码:
Inputs: K1(.5),K2(.5),Mday(1),Nday(1);
Vars: BuyRange(0), SellRange(0);
Vars: BuyTrig(0),SellTrig(0);
Vars: HH(0),LL(0),HC(0),LC(0);
If CurrentBar > 1 Then Begin
HH = Highest(High,Mday);HC = Highest(Close,Mday); LL = Lowest(Low,Mday); LC = Lowest(Close,Mday);
If (HH - LC) >= (HC - LL) Then Begin
SellRange = HH - LC;
End Else Begin
SellRange = HC - LL; End; HH = Highest(High,Nday); HC = Highest(Close,Nday);
LL = Lowest(Low,Nday); LC = Lowest(Close,Nday);
If (HH - LC) >= (HC - LL) Then Begin
BuyRange = HH - LC;
End Else Begin
BuyRange = HC - LL; End; BuyTrig = K1*BuyRange; SellTrig = K2*SellRange;
If MarketPosition = 0 Then Begin
Buy at Open of next bar + BuyTrig Stop; Sell at Open of next bar - SellTrig Stop; End;
If MarketPosition = -1 Then Begin
Buy at Open of next bar + Buytrig Stop; End;
If MarketPosition = 1 Then Begin
Sell at Open of next bar - SellTrig Stop; End; End;
米框源码链接:Dual ThrustDual 源码