加载中…
个人资料
程式交易员联盟
程式交易员联盟
  • 博客等级:
  • 博客积分:0
  • 博客访问:20,467
  • 关注人气:476
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

据说有90%胜率de交易系统样本

(2006-03-27 00:07:33)
分类: ★系统交易相关
据说有90%胜率de交易系统样本
A system giving over 90% profitable trades.
 

{****************************************************
The Simplest System #3 with Money Management.
Copyright (c) 2002 DT
****************************************************}
 

Input: Price((H+L)*.5), {中间价}
PtUp(4.), PtDn(4.), {Max correction to change trend}
MM_Model(2), {1 = % Risk Model; 2 = % Volatility Model;
3 = Drawdown Model; 4 = Kelly Model; 5 = Williams' Model;
6 = Fixed Ratio Model; 7= Market Money Model}
MM(1), {% Risk parameter}
MM_add(0), {% Risk for playing market money; 0 to disactivate}
MaxVolat(100), {% Risk for playing market money; 100 to disactivate}
MaxDD(20), {% Drawdown 资金回撤率}
InitCapital(100000); {Initial capital to trade 开始资金}
Vars: LL(99999), HH(0), Trend(0), Volat(TrueRange);
Vars: MP(0), Risk(Range), Num(1), add_num(0), red_num(0), FRDelta(0),
DD(0),
Equity(InitCapital), TotalEquity(InitCapital), EqTop(InitCapital),
AssuredProfit(0), HPositionProfit(0), Kelly(0);
 

MP = MarketPosition;
Volat = .5 * TrueRange + .5*Volat[1];
if MP <= 0 then begin
if Price < LL then LL = Price;
if Price cross above LL*(1 + PtUp*.01) then begin
Trend = 1;
HH = Price;
end;
end;
if MP >= 0 then begin
if Price > HH then HH = Price;
if Price cross below HH*(1 - PtDn*.01) then begin
Trend = -1;
LL = Price;
end;
end;
If trend = 1 then Risk = PtDn * .01 * close {+ Slippage};
If trend = -1 then Risk = PtUp * .01 * close {+ Slippage};
HPositionProfit = maxlist( OpenPositionProfit, HPositionProfit);
AssuredProfit = HPositionProfit - Risk;
Equity = InitCapital + NetProfit;
TotalEquity = Equity + OpenPositionProfit;
EqTop = MaxList(EqTop, TotalEquity);
if MM_Model = 1 then { % Risk Model }
Num = floor(MM * Equity *.01/Risk);
if MM_Model = 2 then { % Volatility Model }
Num = floor(MM * Equity *.01/ Volat / BigPointValue );
if MM_Model = 3 then begin { Drawdown Model }
Num = floor(MM * (Equity - (1 - MaxDD*.01) * EqTop) * .01 / Volat /
BigPointValue);
end;
if MM_Model = 4 then begin { Kelly Model }
If TotalTrades > 20 and GrossProfit > 0 then
Kelly = NumWinTrades/TotalTrades * (1 - GrossLoss/GrossProfit)
else
Kelly = 0.1;
if Kelly > .9 then Kelly = .9;
Num = floor(MM * Kelly * Equity * .01 / Risk);
{Print(Kelly);}
end;
if MM_Model = 5 then begin { Larry Williams' Model }
value11 = MaxList(-LargestLosTrade / MaxList(CurrentContracts, 1) , Risk);
Num = floor(MM * Equity *.01 / value11);
end;
if MM_Model = 6 then begin { Fixed Ratio Model }
{ DD = MaxList(DD, (EqTop - TotalEquity)/MaxList(CurrentContracts, 1)) ; {Max
Drawdown}
if TotalTrades > 20 and DD > 0 then FRDelta = MM * DD *.01
else }
FRDelta = MM * volat * BigPointValue * .01; {Delta}
value12 = MaxList(Equity - .5*close*(close + FRDelta)/FRDelta, 0.25);
Num = floor(SquareRoot(2*value12/FRDelta + .25) + .5);
end;
if MM_Model = 7 then { Playing the market money }
num = floor((MM * (InitCapital + MinList(NetProfit, 0)) + MM_add *
MaxList(NetProfit, 0)) * .01 / Volat / BigPointValue);
{ Entries}
if trend = 1 and trend[1] <> 1 then buy("Trend.LE") num contracts at market;
if trend = -1 and trend[1] <> -1 then sell("Trend.SE") num contracts at market;
add_num = floor( MM_add * AssuredProfit * .01/ Volat / BigPointValue);
{ Assured Profit Pyramiding }
if add_num > 0 and OpenPositionProfit > Volat * BigPointValue then begin
if Trend = 1 and MP = 1 then buy("Add.LE") add_num contracts at market;
if Trend = -1 and MP = -1 then sell("Add.SE") add_num contracts at market;
end;
red_num = floor((CurrentContracts * Volat * BigPointValue - MaxVolat *
TotalEquity * .01)/ close);
if red_num > 0 then begin
if Trend = 1 and MP = 1 then exitlong("Red.LX") red_num contracts at market;
if Trend = -1 and MP = -1 then exitshort("Red.SX") red_num contracts at
market;
end;
if Num < 1 then Num = 1;
 
 
这个系统很简单的,大概说明以下:
1 从“MP = MarketPosition; ”开始才是指令,前面为参数说明,变量定义
2 MarketPosition表示多头空头,这是一个双向交易系统,多头、空头规则不同
3 然后是一段趋势跟踪:
if MP <= 0 then begin
if Price < LL then LL = Price;
if Price cross above LL*(1 + PtUp*.01) then begin
Trend = 1;
HH = Price;
end;
end;
if MP >= 0 then begin
if Price > HH then HH = Price;
if Price cross below HH*(1 - PtDn*.01) then begin
Trend = -1;
LL = Price;
end;
end;
4 然后是一段风险计算指令
If trend = 1 then Risk = PtDn * .01 * close {+ Slippage};
If trend = -1 then Risk = PtUp * .01 * close {+ Slippage};
HPositionProfit = maxlist( OpenPositionProfit, HPositionProfit);
AssuredProfit = HPositionProfit - Risk
5 然后是头寸计算指令,一共有7种模型
... ...
6 然后是开仓指令
{ Entries}
if trend = 1 and trend[1] <> 1 then buy("Trend.LE") num contracts at market;
if trend = -1 and trend[1] <> -1 then sell("Trend.SE") num contracts at market;
交易采用市价指令,趋势变化时发出,trend[1]相当于ref(trend,1)
7 然后是加仓指令
if Trend = 1 and MP = 1 then buy("Add.LE") add_num contracts at market;
if Trend = -1 and MP = -1 then sell("Add.SE") add_num contracts at market;
多头趋势多头市场继续买,空头趋势空头市场继续卖
8 最后一段是平仓指令

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有