开拓者期货期权程序化系统交易论坛

标题: 自适应动态突破系统(Dynamic Break Out II)tb版 [打印本页]

作者: ilian    时间: 2008-9-13 13:50:59     标题: 自适应动态突破系统(Dynamic Break Out II)tb版

Params
    Numeric ceilingAmt(60);
    Numeric floorAmt(20);
    Numeric bolBandTrig(2.00);
Vars
    Numeric lookBackDays(20);         
    Numeric todayVolatility(0);
    Numeric yesterDayVolatility(0);
    Numeric deltaVolatility(0);
    NumericSeries buyPoint(0);
    NumericSeries sellPoint(0);
    NumericSeries longLiqPoint(0);
    NumericSeries shortLiqPoint(0);
    Numeric upBand(0);
    Numeric dnBand(0);
    Numeric MidLine(0);
    Numeric Band(0);
Begin
    todayVolatility = StandardDev(Close,30,1);
    yesterDayVolatility = StandardDev(Close[1],30,1);
    deltaVolatility = (todayVolatility - yesterDayVolatility)/todayVolatility;
    lookBackDays = lookBackDays * (1 + deltaVolatility);
    lookBackDays = Round(lookBackDays,0);
    lookBackDays = Min(lookBackDays,ceilingAmt);
    lookBackDays = Max(lookBackDays,floorAmt);
    MidLine = AverageFC(Close,lookBackDays);
    Band = StandardDev(Close,lookBackDays,bolBandTrig);
    upBand = MidLine + bolBandTrig * Band;
    dnBand = MidLine - bolBandTrig * Band;
    buyPoint = Highest(High[1],lookBackDays);
    sellPoint = Lowest(Low[1],lookBackDays);
    longLiqPoint = Average(Close[1],lookBackDays);
    shortLiqPoint = Average(Close[1],lookBackDays);

if(Close > upBand)  
{
   If(CrossOver(high,buyPoint))   
  {
     Buy(1,max( buyPoint, Low ));

  }
Commentary("多头触发价:"+Text(buyPoint));

}

if(Close < dnBand)
{

   If(CrossUnder(Low,sellPoint ))
   {
      SellShort(1,min( sellPoint , High ));
   }
Commentary("空头触发价:"+Text(sellPoint));

}
if(MarketPosition == 1)
{  
   If(CrossUnder(Low,longLiqPoint ))
   {
      Sell(1,min( longLiqPoint , High ));
   }
Commentary("多头退出:"+Text(longLiqPoint));
}




if(MarketPosition == -1)

{
   If(CrossOver(high,shortLiqPoint))   
  {
     BuyToCover(1,max( shortLiqPoint, Low ));
  }
Commentary("多头退出:"+Text(shortLiqPoint));

}


End

[ 本帖最后由 ilian 于 2008-9-13 14:11 编辑 ]
作者: szkpt    时间: 2008-9-13 19:21:56

Tb的学习气氛越来越好了,鼓励一下,只有大家互相学习和交流,才能互相提高....
希望有一天能象学习MT的人一样多,一样交流啊...
作者: future    时间: 2008-9-14 10:10:46

写的不错,鼓励一个
作者: 只求薄利    时间: 2008-9-14 13:27:42

MT是垃圾,特指国内的冒名MT,并非MT4
作者: nickchen    时间: 2008-9-15 10:41:33

非常好的系统  本人刚刚的在别的论坛上看到分析家版的这个系统。值得学习!!!
作者: zhx163    时间: 2008-9-15 14:30:31

效果不咋地
作者: chxdh    时间: 2008-9-17 22:13:12

努力学习中
作者: bigbear2046    时间: 2008-9-18 01:34:14

文字表述呢?
这样一股脑上来代码  却不写思路 不易理解
作者: ilian    时间: 2008-9-18 11:15:05

原帖由 bigbear2046 于 2008-9-18 01:34 发表
文字表述呢?
这样一股脑上来代码  却不写思路 不易理解

这里有一段解说

THE DYNAMIC BREAK OUT II STRATEGY
George Pruitt for Futures Magazine designed the original Dynamic Break Out
system in 1996. This version has done well since it was released for public consumption
in 1996. This version will be included in Appendix B. The newer
version of the Dynamic Break Out is just like the original, except we have
incorporated an additional adaptive filter.
The key to the Dynamic Break Out II system is its ability to adapt its
parameters to current market conditions. This system is based on the triedand-
tested Donchian channel system. Remember how the Donchian system
works; buy when the high of the day penetrates the highest high price of x bars
back, and sell when the low of the day penetrates the lowest low of x bars back.
If you optimize the number of bars to determine your best entry and exit levels,
you will discover that different markets work better with different parameters.
You will also discover that a particular market goes through different
cycles and works better with different parameters through time. For example,
the Japanese Yen may have performed better with a look back of 40 days in the
1980s, but now works better with a look back of 20 days. That is the major
problem with using a static parameter for all markets. The Dynamic Break Out
II system allows the number of look back days to change with the current market.
Instead of using a static parameter, this system changes the parameters
based on an aspect of the current market.
Before you can use an adaptive parameter, you must come up with a function
or adaptive engine that automatically changes the value of the once static
parameter. The input of this adaptive engine should be some form of market
statistic. In the case of the Dynamic Break Out II, we used market volatility.
When market volatility expands, so does the number of look back days in
our break out calculation. Increased market volatility usually equates to market
indecisiveness. By increasing the number of look back days when market
volatility increases, we make it more difficult for the system to initiate a trade.
When market volatility decreases, we reduce the number of look back days.
Low market volatility equates to a trending market. By decreasing the number
of look back days, we encourage the system to initiate a trade. This helps the
Dynamic Break Out II to lock into long-term profits and be on the look out
for a change in the long-term trend. We used market volatility to fuel our
adaptive engine, but you could use any market characteristic. We can visualize
an engine that uses a market’s overbought/oversold state. If we had a long
position in a market, and it became overbought, we could use an overbought/
oversold indicator to adapt the parameter that determines the sell point.
Once an adaptive engine is dreamed up and it is pumping out values, you
must maintain the values in an acceptable range. The Dynamic Break Out II
system will not let the look back days go above 60 or below 20. Through optimization,
we discovered that look back lengths that fell beyond these bound-

aries did not generate acceptable expectations. An adaptive engine that generates
useless values is useless in itself.
The Dynamic Break Out II initially looks back 20 days to determine its
buy and sell levels. So when you start trading this system, your first buy point
is the highest high of the past 20 days and your sell point is the lowest low of
the past 20 days. At the end of each day, you measure the current market
volatility by calculating the standard deviation of the past 30 day’s closing
prices. Market volatility can be measured using different calculations: average
range, average true range, standard deviation of change in closing prices, and
others. Once we determine today’s market volatility, we compare it with yesterday’s.
If the volatility increases, then the number of look back days also
increases. We change the number of look back days to the exact amount of the
change in market volatility; if volatility increases by ten percent, then so does
the number of look back days and vice versa.
The original Dynamic Break Out made its buying and selling decisions
solely based on the highest high and lowest low values that were generated by
our volatility-based adaptive engine. Once a position was initiated, a simple,
yet effective, $1500 money management stop was put into place. The newer
version uses the same entry technique in concert with an adaptive Bollinger
Band. The length of the Bollinger Band calculation is the same number of look
back days that is generated by the adaptive engine. The close of yesterday must
be above the upper band and today’s high must be greater than or equal to the
highest high of x bars back before a long position can be initiated (x bars back
is equal to our adaptive look back days value). Yesterday’s close must be below
the lower band and today’s low must be less than or equal to the lowest low of
x bars back before a short position can be taken. Instead of the simple money
management stop, we incorporated a dynamic trailing stop. As we have discussed,
the number of look back days changes on a daily basis. The adaptive
engine decides the amount of change. The liquidation point of an existing
trade is determined by calculating a simple moving average of closing prices for
the past look back days. The sell liquidation would be just the opposite of the
buy liquidation.
作者: CHENYP2000    时间: 2008-9-21 16:30:33

longLiqPoint = Average(Close[1],lookBackDays);
    shortLiqPoint = Average(Close[1],lookBackDays);

请问什么意思?为何相同?
作者: 趋势跟踪    时间: 2010-7-24 13:56:38

非常好的交易系统,学习了!
作者: 晶都金牛    时间: 2010-10-23 16:16:51

ZN 1分钟周期测试效果不错,收藏了
作者: jackwjgd    时间: 2010-11-1 08:34:10

下载学习
作者: jinxueli    时间: 2011-6-10 12:14:47

这个系统怎么测试和实际成交不同,还出现信号反复的问题
作者: jsz123    时间: 2011-6-13 17:13:24

不好不好  危险危险!
作者: cym138    时间: 2011-6-13 21:08:30

应用于什么周期的?
作者: freetiger    时间: 2011-6-18 11:55:46

If(CrossOver(high,buyPoint))

这一句在TB4提示可能有逻辑错误,请教怎么解决的?
作者: jjtiger    时间: 2011-6-20 20:19:41

努力学习中
作者: jsz123    时间: 2011-6-28 22:29:33

未来函数颐大堆!
作者: livepu    时间: 2011-11-6 11:56:40

含未来函数,而且我觉得原来的设计有点问题。
作者: hdh4638    时间: 2012-3-18 10:31:55

本帖最后由 hdh4638 于 2012-7-3 20:55 编辑

没人表扬,割了好了!
作者: 天崖    时间: 2012-6-9 20:22:22

请管理员及高手,测试一下21#的模型,有没有未来函数?有没有偷价格?可以用于实盘吗???
作者: 水流深    时间: 2012-6-9 20:50:04

经典的策略
作者: 天崖    时间: 2012-6-9 21:43:22

请问管理员及高手,看看21#的模型,可以实盘吗?开、平仓信号指令会漂移、闪烁吗???
作者: 天崖    时间: 2012-6-9 21:43:53

请管理员及高手,看看21#的模型,可以实盘吗?开、平仓信号指令会漂移、闪烁吗???
作者: zzzlondon    时间: 2012-6-11 09:02:38

我觉得21楼改得很好
作者: chenzhiling    时间: 2012-6-21 16:37:03

zzzlondon 发表于 2012-6-11 09:02
我觉得21楼改得很好

拿股指1分钟线做 今年是亏很多。
作者: zzzlondon    时间: 2012-6-23 21:59:33

chenzhiling 发表于 2012-6-21 16:37
拿股指1分钟线做 今年是亏很多。

我只是说他把源代码逻辑问题改掉了,不是说策略效果
作者: tonyb2    时间: 2012-6-23 22:36:30

希望有更多的模型公布出来供大家学习提高!!
作者: tonyb2    时间: 2012-6-23 22:39:42

有人改进过吗?
作者: 我本渺小    时间: 2012-8-6 01:26:47

逻辑有错误的,有未来函数在作怪
作者: 不羁    时间: 2012-8-7 09:41:26

不懂, 哪里有未来函数?
作者: yangedwin99    时间: 2012-8-14 16:46:58

crossover 有问题
作者: 期市劫匪    时间: 2012-8-15 12:29:50


作者: 股缠者∮    时间: 2012-10-10 00:09:37


作者: 股缠者∮    时间: 2012-10-10 23:55:16

顶起
作者: runcai    时间: 2012-10-19 15:51:36

MidLine = AverageFC(Close,lookBackDays);
应该改成 MidLine = Average(Close,lookBackDays);
lookBackDays是动态的,用AverageFC计算会出错。
作者: fengyun    时间: 2012-10-21 21:59:53

很好的策略 支持下
作者: tcx    时间: 2012-10-22 09:20:36

这个策略的好处就是lookBackDays,大家有没有什么好的过滤条件呢。不知道21楼怎么改的啊
作者: zhen2710    时间: 2012-10-24 13:54:51

hdh4638 发表于 2012-3-18 10:31
没人表扬,割了好了!

您是不是发过 改进版的程序代码  您后来又删除了??
作者: zzy    时间: 2012-11-28 14:00:41


作者: GT11080081_yuan    时间: 2013-10-20 10:32:28

原理思路一点没错,就是程序编写有问题,偷价太过明显,可以自己改进成可用系统,其实最关键是前面计算波动率方法效果如何,不得而知,我现在连计算波动率的思路都没有,先改成实盘模型再说,谢谢楼主共享




欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/) Powered by Discuz! X2