文华与开拓者通用的dual thrust系统策略源码

dual thrust系统原形

 

 开拓者TB源码: 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;

 

 

 

 
 
文华财经源码:
M:=1;
 M1:=1;
 K1:=0.5;
 K2:=0.5;
 N:=BARSLAST(DATE<>REF(DATE,1))+1;
 OO:=VALUEWHEN(DATE<>REF(DATE,1),O);
 HH1:=REF(HHV(H,N*M),N);
 LL1:=REF(LLV(L,N*M),N);
 HC1:=REF(HHV(C,N*M),N);
 LC1:=REF(LLV(C,N*M),N);
 HH2:=REF(HHV(H,N*M1),N);
 LL2:=REF(LLV(L,N*M1),N);
 HC2:=REF(HHV(C,N*M1),N);
 LC2:=REF(LLV(C,N*M1),N);
 SELLR:=IFELSE((HH1-LC1)>=(HC1-LL1),HH1-LC1,HC1-LL1);
 BUYR:=IFELSE((HH2-LC2)>=(HC2-LL2),HH2-LC2,HC2-LL2);
 BT:=K1*BUYR;
 ST:=K2*SELLR;
 BUYP:=OO+BT;
 SELLP:=OO-ST;

 H>=BUYP&&C>=MAX(O,BUYP),BPK;
 L<=SELLP&&C<=MIN(O,SELLP),SPK;
 AUTOFILTER;


 



来函数检测结果如下:
该公式没有未来函数

解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图