欢迎光临
专业期货策略平台

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

这是一套文华程序化与开拓者通用的Dual Thrust系统的策略,下面的源代码是文华的源码,对于期货程序化有研究的朋友,可以下载研究学习。对于初学者用户可以在网站找到文华程序化开发教程,对应学习。如果用户想要把程序化源代码移植到开拓者,可以找一下我们A期客网 上的学习教程,自己来转换一下。

Dual Thrust系统是 Michael Chalek 在80 年代开发的 Dual Thrust。在自动化交易排名中,目前为止,仍然排名第二左右。

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;
0 0 vote
Article Rating
Click to rate this post!
[Total: 0 Average: 0]
赞(3) 打赏
未经允许不得转载:A期客 » 文华与开拓者通用的Dual thrust系统策略源码
订阅
提醒
guest
0 评论
Inline Feedbacks
View all comments

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

0
Would love your thoughts, please comment.x
()
x