龙听期货论坛's Archiver

龙听 发表于 2020-7-23 15:48

期货量化策略精选系列04-Dynamic Break Out II Program原理、源码及回测情况

第一楼、原理:
本系统是”Building winning Trading Systems with TradeStation”裡面的第四個系統。這是屬於適應性(Adaptive)系統之一,所謂的適應性系統的觀念,是指這種系統的參數,會依據市場目前的狀況而自行調整。
舉例來說,Donchian Channel(也就是我最愛的Price Channel Breakout)系統,如果參數設的太短(比如說20天的價格突破),那麼在趨勢明確的市場裡就會表現的不錯,因為可以在行情剛啟動的時候就產生訊號進場。而且出場的機制也會跟蹤的比較緊密,不容易讓到手的獲利回吐出去。但是太短的參數在擺盪的市場裡,就會因為進出場訊號出現的太頻繁而導致常常被巴來巴去。所以在擺盪的市場裡,應該要把參數設得比較長一點(比如說60天的價格突破),讓訊號不要產生的那麼頻繁而導致反覆被巴的情形。而Adaptive System(適應性系統)的設計原則,就是讓系統本身的參數會依據目前市場的狀況而自行調整參數本身的值,而不是像一般人常用的固定參數值的方式。

龙听 发表于 2020-7-23 15:49

第二楼、简介及框架

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 tried-and-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.

(谷歌翻译如下:)

期货杂志的乔治·普鲁伊特(George Pruitt)于1996年设计了原始的动态突破系统。此版本自1996年发布以供公众使用以来,效果很好。此版本将包含在附录B中。动态突破的新版本就像原来的,除了我们加入了一个额外的自适应滤波器。
动态突破II系统的关键在于其能够使其参数适应当前市场条件的能力。该系统基于久经考验的Donchian通道系统。记住Donchian系统是如何工作的;当日高点突破x线的最高价时买入;当日低点突破x线的最低价时卖出。如果您优化柱线数量以确定最佳的进场和退出水平,您会发现不同的市场使用不同的参数会更好。您还将发现特定市场经历不同的周期,并且随着时间的推移在不同的参数下效果更好。例如,日元在1980年代回溯40天的表现可能更好,但现在回首20天的回溯效果更好。这是对所有市场使用静态参数的主要问题。 Dynamic Break Out II系统使回溯天数随当前市场而变化。该系统不使用静态参数,而是根据当前市场的一个方面更改参数。

在使用自适应参数之前,必须提供一个函数或自适应引擎,该函数或自适应引擎会自动更改一次静态参数的值。这种自适应引擎的输入应该是某种形式的市场统计数据。在动态突破II中,我们使用了市场波动性。当市场波动扩大时,我们的突破计算中的回顾天数也会增加。市场波动性的增加通常等同于市场的犹豫不决。通过增加市场波动性增加的回顾天数,我们使系统开始交易变得更加困难。当市场波动性降低时,我们会减少回溯天数。低市场波动等于趋势市场。通过减少回溯天数,我们鼓励系统启动交易。这有助于Dynamic Break Out II锁定长期利润,并在寻找长期趋势的变化。我们使用市场波动来推动我们的自适应引擎,但是您可以使用任何市场特征。我们可以可视化使用市场超买/超卖状态的引擎。如果我们在市场上拥有多头头寸,并且变得超买,则可以使用超买/超卖指标来调整确定卖点的参数。
一旦实现了自适应引擎并输出了值,则必须将值保持在可接受的范围内。动态突破II系统不会使回溯天数超过60或低于20。通过优化,我们发现回溯长度超出这些限制范围并不能产生可接受的期望。产生无用值的自适应引擎本身就是无用的。

动态突破II最初会回顾20天以确定其购买和出售水平。因此,当您开始交易该系统时,您的第一个买入点是过去20天的最高点,而卖出点是过去20天的最低点。在每天结束时,您可以通过计算过去30天收盘价的标准差来衡量当前市场的波动性。可以使用不同的计算方法来测量市场波动性:平均范围,平均真实范围,收盘价变化的标准偏差等。一旦确定了今天的市场波动性,便可以将其与昨天的波动性进行比较。如果波动性增加,那么回溯天数也会增加。我们将回溯天数更改为市场波动的确切数量;如果波动率增加了百分之十,那么回溯天数也会增加,反之亦然。
最初的“动态突破”仅基于我们基于波动率的自适应引擎产生的最高和最低价值来做出购买和出售决策。一旦开始头寸,一个简单但有效的1500美元资金管理站就位。较新的版本与自适应布林带一起使用相同的输入技术。布林带计算的长度与自适应引擎生成的回溯天数相同。昨天的收盘价必须高于上限,并且今天的高点必须大于或等于x柱的最高高点,然后才能启动多头头寸(x柱等于我们的自适应回顾天数)。昨天的收盘价必须低于下限,今天的低点必须小于或等于x柱的最低低点,然后才能做空头寸。代替简单的资金管理止损,我们加入了动态追踪止损。正如我们所讨论的,回溯天数每天都在变化。自适应引擎决定变化量。现有交易的清算点是通过计算过去回顾日收盘价的简单移动平均值来确定的。卖出清算与买入清算正好相反。

龙听 发表于 2020-7-23 15:55

第三楼、策略专版:[url]http://www.qhlt.cn/forum-681-1.html[/url]

龙听 发表于 2020-7-23 15:55

第四楼:策略程式码:[url]http://www.qhlt.cn/thread-84675-1-1.html[/url]

龙听 发表于 2020-7-23 15:58

第五楼:测试随后贴上。

龙听 发表于 2020-7-23 15:59

第六楼:总结

Dynamic Break Out II Summary
Yet again, another successful long-term trading approach. We guess we let the cat out of the bag . . .and what an ugly cat it is. The majority of successful trading systems are of the long-term trend following variety. Almost all traders realize this fact, but it doesn’t stop them from searching out a shorter-term approach. See, the trend-following systems require diversification, which requires hefty capitalization. Also, trend-following systems can have substantial draw downs and go for years without making any money. The typical trader cannot persevere through these bad attributes, even though they know they will probably be rewarded in the long run.
Even this dynamic approach couldn’t capture a profit in the soybean market. The continual failure of trend-following systems in the grain markets begs the question, “Why don’t these systems work in the soybean or grain markets?” These markets move in a cyclical fashion due to the seasonality aspect of their underlying fundamentals. If we know ahead of time that these markets have this cyclical nature, then why can’t we capture their movements? Cycles are very difficult to calculate and determine and, therefore, are usually overlooked. The two most predominant methods for finding cycles are trigonometric curve fitting and Fourier (spectral) analysis. The mathematics behind these two methods is relatively complex and detailed. We personally have never seen a pure mathematically-based, cycle-finding trading system outperform the typical trend follower. If you do have any interest in this area, we refer you to John Ehlers, Rocket Science for Traders (John Wiley, 2001).
Before we move on, let’s use our TradeStation for two different experiments. The first experiment will deal with the Dynamic Break Out II system and the soybean market. We saw how virtually useless the system was for capturing the trends in the soybean market. What would happen if we faded the trade signals? What we mean by fade is to do just the opposite. So, instead of buying at our long entry point, we will sell and vice versa. If the soybean market moves in cycles, which is countertrend, then we should be able to improve our performance by entering against the prevalent trend. Table 6.5 shows the performance of our countertrend soybean system.
No question that it did better, but overall it is still nothing to write home about. This somewhat proves that soybeans and other grain markets cannot be successfully traded by a longer-term trend-following approach. Since we are on the subject of cycles and seasonality, why don’t we program a strategy that incorporates a seasonality filter? We will demonstrate how to use the keyword date to determine the current month and day. This system will trade the soybeans and will only take long signals from March 1 to July 1 and will only take short signals from July 2 to February 28. These dates were derived from cyclical analysis of historical data on soybeans.

龙听 发表于 2020-7-23 16:00

第六楼续:(谷歌翻译内容)

动态突破II摘要
再一次,另一种成功的长期交易方法。我们猜想我们把猫从书包里拿出来了。 。那是一只丑陋的猫。大多数成功的交易系统都具有长期的发展趋势。几乎所有交易者都意识到了这一事实,但这并没有阻止他们寻找短期方法。请参阅,遵循趋势的系统需要多样化,这需要大量资本。此外,趋势跟踪系统可能会大幅缩水,并且持续数年却没有赚钱。尽管典型的交易者知道从长远来看它们可能会得到回报,但他们无法坚持不懈地克服这些不利因素。
即使采用这种动态方法,也无法在大豆市场中获利。谷物市场中趋势跟踪系统的持续失败引出了一个问题:“为什么这些系统在大豆或谷物市场中不起作用?”这些市场由于其基本面的季节性因素而周期性地变动。如果我们提前知道这些市场具有周期性,那么为什么我们不能掌握它们的动态呢?周期很难计算和确定,因此通常被忽略。查找循环的两种最主要方法是三角曲线拟合和傅立叶(频谱)分析。这两种方法背后的数学是相对复杂和详细的。我们个人从来没有见过过一个纯粹的基于数学的,周期发现的交易系统胜过典型的趋势追踪器。如果您对这方面有任何兴趣,请参考John Ehlers,《交易者的火箭科学》(John Wiley,2001年)。

在继续之前,让我们使用TradeStation进行两个不同的实验。第一个实验将涉及动态突破II系统和大豆市场。我们看到了该系统实际上对于捕获大豆市场的趋势几乎毫无用处。如果我们取消交易信号会怎样?我们所说的淡入淡出就是相反的意思。因此,我们将不再出售自己的长切入点,反之亦然。如果大豆市场周期变化,这是反趋势,那么我们应该能够通过抵制流行趋势来改善我们的表现。表6.5显示了我们的反趋势大豆系统的表现。
毫无疑问,它做得更好,但是总的来说,仍然没有什么值得写的。这在某种程度上证明了大豆和其他谷物市场无法通过长期的趋势跟踪方法成功进行交易。由于我们的主题是周期和季节性,所以为什么不编写包含季节性过滤器的策略?我们将演示如何使用关键字date来确定当前月份和日期。该系统将交易大豆,并且仅在3月1日至7月1日之间采取多头信号,而在7月2日至2月28日之间仅采取空头信号。这些日期来自对大豆历史数据的周期性分析。

页: [1]