找回密码
 注册
搜索
查看: 4656|回复: 49

[技术分析] Maximum Entropy Spectral Analysis

[复制链接]
发表于 2009-11-15 05:54 PM | 显示全部楼层 |阅读模式


Quote from 流动的建筑
There might be multiple paths, but only one truth.


I think Maximum Entropy Spectral Analysis (MESA) is one of them. The purpose of this post is to provide a background introduction, and solicit discussion from people with same interest.

基本思想
单纯从信号分析角度考虑,股市的波动可以看成是不同波长,不同幅度的波的叠加。从股市的结构来看,股市上有不同类型的投资者和交易员,交易周期从几分钟到几年的都有,这正好对应不同的波长。而每个人能调动的现金量也不同,这正好对应不同的波动幅度。根据相同的原因,股市中的trend也只是周期足够大,振幅足够高的波动。MESA方法通过频谱分析,希望能找到在每一个时刻在股市中起主导地位的波动,然后交易员可以根据这个波动交易。

理论基础
从信息论角度来看,熵越大则可以表示的信息越丰富,也意味着加在信息上的限制越少。这是最大化熵方法的一个理论基础,也就是在分析时最小化额外的限制。这如同做股市技术分析时不带任何偏见。从热力学角度来看,任何一个系统都向熵增加的方向发展。这是最大化熵方法的另一个理论基础。粗略的说,这样得到的结果是系统最有可能自由发展出的结果。

技术方法
只粗略介绍一下过程。MESA的输入数据很简单,就是对信号的离散采样。对股市而言对应每天的收盘价格。首先计算样本的autocorrelation,然后根据autocorrelation计算出频谱函数的对应参数。细节可以参考John Parker Burg的论文。附件是论文最核心部分。

实际应用
No wonder,已经有人在卖用这个方法生成的信号了。我没有用过,没法说效果如何。所以也不能算是做广告。 这里贴张图,是MESA的频谱分析和FFT(傅里叶)分析的对比,明显MESA的结果能得到最主要的波动周期,而FFT得到的结果糊做一团。这个mesasoftware还提供其他的指标,MESA是最贵的一个。另外还有很多technical paper可以下载,有signal processing背景的人可以看看,应该会有很多启发。

上边的图是每个时刻MESA得到的频谱的heat map,下面的是FFT的heat map。明显MESA的效果要好很多。
dftvsmesa.gif

Again quote from 流动的建筑
The importance is independent thinking.


贴这个帖子是希望能inspire more independent thinking。先说说自己的。

Afterthought
1. 因为股市在不停变化,因此技术分析最好采用用最短的历史数据来得到最多的信息。 这是MESA的一个优势。
2. 最重要的是模型。有了模型,基本上所有的处理模型的技术都已经被学术界发现了。MESA是波动模型,当然这只描述了股市规律的一个侧面。

MESA.pdf

541.73 KB, 下载次数: 86

评分

4

查看全部评分

发表于 2009-11-16 02:26 AM | 显示全部楼层
Nice.

补充一点。
这个软件的作者 Ehlers是两本书的作者
Cybernetic Analysis for Stocks and Futures
Rocket Science for Traders - Digital Signal Processing Applications
看书名就知道是干什么的。

Quantum老大对这些东西很有研究,可惜他现在不怎么出现了。
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 02:37 AM | 显示全部楼层
Nice.

补充一点。
这个软件的作者 Ehlers是两本书的作者
Cybernetic Analysis for Stocks and Futures
Rocket Science for Traders - Digital Signal Processing Applications
看书名就知道是干什么的。

...
rnhoo 发表于 2009-11-16 02:26



你用过这个MESA indicator吗?效果如何?
查了一下Quantum,确实很久没来过了。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 08:59 AM | 显示全部楼层
Read this before you jumping into the bandwagon

A Balanced Review, October 30, 2003
By         "hlcnprgrno"
Whoever reads the reviews for this book will note the polarity: people either think it's wonderful or it's horrid. I'll try to give a more balanced review here.

* This book is for the mathematically/analytically inclined. If you don't consider yourself in this category, I would not suggest this book. At the VERY least you should have a solid background in trigonometry.

* This book is exactly what is says: Digital-Signal Processing (DSP) applied to stock trading. I myself am an Electrical Engineer who's day-job consists of about 90% DSP-work / 10% other tasks. For this reason, I believe I can fairly say that the DSP concepts presented are done so in a fairly clear and fairly accurate manner (this varies from time-to-time).

* Most of the concepts presented in Ehlers' book would be what I consider "traditional" DSP. There is a problem here (that is almost completely overlooked in the book): "Traditional" DSP is based on a series of assumptions that must be at least approximately fulfilled. Recent academic research has tended to show that stock-market "signals" tend NOT to fulfill these assumptions very well. In some ways, this puts a significant dent (in my view) in the theory used as the basis for the indicators derived.

* The attention to detail at times is very obtrusive to a reader with a keen eye and understanding of what is being described. For example: there is (what I consider to be) a glaring error in the MAMA filter that no one has ever pointed out and that is not corrected on his website. How has this escaped notice for so long? [Side note: be careful about his claim that MAMA's avoid whipsaws - they DON'T at all in ranging markets!]

* Two mechanical systems are described in detail in the book: the SineTrend Automatic System and the ZeroLag Intraday System. I have EXTENSIVELY tested both systems, exactly as described in the book, on a very-wide range of stocks, commodities, and currencies. These simulations were carried out using a test suite I had developed for my own use to simulate trading conditions as realistically as possible. This includes conservative, but realistic allowances for slippage, commissions ($15 round-turn), and signal reaction.

Ehlers results for the SineTrend Automatic System grab your attention in the book (greater than $100,000). However, no initial investment is listed in the book and one should be careful to note that these results are over a 15 year period. Assuming a $10000 initial investment (though this isn't specified in the book), this is a 17% annual return. Not bad, not great.

The REAL problem here is that a more realistic simulation shows that one is hard-pressed to show ANY profit on ANY type of stock/commodity/currency. I've tried the system (unaltered) on dozens of instruments, with a couple rather moderate successes and the rest losing money terribly, even with reasonable stop losses and money management.

* Almost (if not all) of Ehler's graphs in his book are from the same time series: specifically the US96H (March 1996 Treasury Bond contracts). I HAVE been able to reproduce all of the graphs in his book using the indicators: so there is no falsification in them, as implied in other reviews. However, the time period under consideration shows a series with nearly ideal characteristics for Ehlers systems, while almost all other series I've tested his indicators and systems on do not exhibit the same performance.

* MOST ALL of the information presented in his book is available for FREE download on his website as Word DOCs. There is also a lot of other papers he has written available on the site.

* Ehlers is doing what I think needs to be done in the trading industry: trying new techniques and methods. He has a good grasp of the electrical-engineering concepts and how to apply them to trading, but the results presented in his book are NOT indicative of TYPICAL results of the performance of his systems. The ideas and the theory behind them are, generally, good, though he is a bit prone in parts to handwaving and glossing-over of some obvious pitfalls (obvious, at least, to another electrical engineer).

* For the mathematically-inclined who enjoy working on their own ideas and own systems, this book could give you a lot of insight into technical trading and provide some good jumping-off points to developing systems that are TRULY profitable. I have yet to see (or develop) one that I would be willing to risk real money on and I would caution readers from thinking that either of the two systems presented will provide the type of profits described in the book.

To all others (probably the vast majority of those interested in this book!) I would say be very careful before spending your money on this. There is no reliably turn-key system provided in this book, even though there are two that are purported to be such.
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 09:48 AM | 显示全部楼层
4# ranchgirl

This is good info. Thanks a lot!
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 12:02 PM | 显示全部楼层
我确实有这个打算,但还没有用过.因为我不准备买他的软件.
我知道R 有MESA, matlab 好像也有,不过不是很方便,需要做一些格式转换。



你用过这个MESA indicator吗?效果如何?
查了一下Quantum,确实很久没来过了。
Diffusion 发表于 2009-11-16 02:37
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 12:19 PM | 显示全部楼层
我确实有这个打算,但还没有用过.因为我不准备买他的软件.
我知道R 有MESA, matlab 好像也有,不过不是很方便,需要做一些格式转换。



rnhoo 发表于 2009-11-16 12:02

again

What is R? Any link?
我也在考虑有空自己写一个mesa indicator,反正算法都有了。觉得Ninja Trader不错,可以用C#写。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 02:53 PM | 显示全部楼层
http://www.r-project.org/

r is an open source statistical software which is widely used in academy as well as industry. It is the community version of commerial software Splus.

mesa is package "stat" of R

I am not good at EE so my plan is to use Ninja trader (C#) to access R. but before that, I want to fully understand MESA, which is not easy for me, and do some test using R, which should not be too hard, i just need to convert the data format to what R can understand.

if you think write MESA code using C# from scratch is not a big deal, you can do it. but if not, I do recommed you to do some test usng existing software, e.g., R to see if it is worth the investment.
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 03:25 PM | 显示全部楼层
Thanks a lot for the link and the suggestion. I'll need to spend some time on R.

我对这个MESA也是一知半解。因为算法比较清晰,所以才想自己实现。现在有现成的工具,那就先看看效果如何再说。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 04:06 PM | 显示全部楼层
please let me know what you find. thanks.
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 05:39 PM | 显示全部楼层
Sure, anything will be posted along this thread.

And discussions from everyone are welcome here.
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 05:43 PM | 显示全部楼层
熵增加表示有用信息减少,股票更难炒。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 05:44 PM | 显示全部楼层
向Diffusion兄的研究精神致敬!!

回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 06:13 PM | 显示全部楼层
八月份我登出的一些数据就是从某种 pattern entropy 的计算中得来的。
金融危机后,短线 entropy 减小,炒股赚钱的机会增加。
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 06:49 PM | 显示全部楼层
八月份我登出的一些数据就是从某种 pattern entropy 的计算中得来的。
金融危机后,短线 entropy 减小,炒股赚钱的机会增加。
bobcat 发表于 2009-11-16 18:13


此熵非彼熵。
数据的熵增加说明系统的规律性被破坏,具体到交易就是噪声增加,信号有效性下降,而交易利润递减。

最大化熵方法是求解符合一定限制条件的,熵最大,也就是额外限制最小,的频谱。这个方法也可应用于概率,类似于贝叶斯分析里面先验概率和后验概率,据说后验概率是先验概率在发生某个特定事件时的最大熵概率分布,也就是除了先验概率分布和这个特定事件,在完全不知道其他条件的情况下,我们能得到的没有额外限制,没有偏见的概率分布。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 07:59 PM | 显示全部楼层
此熵非彼熵。
数据的熵增加说明系统的规律性被破坏,具体到交易就是噪声增加,信号有效性下降,而交易利润递减。

最大化熵方法是求解符合一定限制条件的,熵最大,也就是额外限制最小,的频谱。这 ...
Diffusion 发表于 2009-11-16 18:49


谢谢解释。你一说我倒想起来了,Katz 与 McCormick 在
“The Encyclopedia of Trading Strategies”(2000) 一书中提到过这一方法,说当时已有几家公司提供
软件用熵最大化方法研究市场周期。我刚才翻了一下这本书,作者对熵最大化方法似乎评价不高。原话是:

"The algorithm does not work very well on noisy, raw data. The problem (then) with passing the data
through a filter, prior to the maximum entropy cycle extraction, is that lag and phase shifts
are induced. Consequently, extrapolations of the cycles detected can be incorrect in terms of phase and timing
unless additional analyses are employed."  

当然这是十年之前的水平,也许现在有了新的进展。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 08:16 PM | 显示全部楼层
熵 applied to trading. interesting.
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 08:24 PM | 显示全部楼层
这个贴很有意思,谢谢 Diffusion!

寻找交易周期是个很困难的问题,我至今还没找到满意的方法,现在基本上是放弃了这条路。主要是没看到有道理的逻辑:为什么市场必须按照某个周期走呢,难道不是价位更重要吗?

有研究发现月末的市场上升的概率要大于其它时间,那是因为401K的原因,还有自然交易日,周末,财政年,节假日,等等,会对市场有影响,这些是我能接受的逻辑。所谓火星冲日立夏冬至月盈月缺等等,在我看到客观的研究报告之前,不是我能接受的逻辑。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2009-11-16 08:33 PM | 显示全部楼层
这个贴很有意思,谢谢 Diffusion!

寻找交易周期是个很困难的问题,我至今还没找到满意的方法,现在基本上是放弃了这条路。主要是没看到有道理的逻辑:为什么市场必须按照某个周期走呢,难道不是价位更重要吗?
...
流动的建筑 发表于 2009-11-16 20:24


不错,股市有季节性,但其它周期研究均不成功。
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2009-11-16 08:53 PM | 显示全部楼层
谢谢解释。你一说我倒想起来了,Katz 与 McCormick 在
“The Encyclopedia of Trading Strategies”(2000) 一书中提到过这一方法,说当时已有几家公司提供
软件用熵最大化方法研究市场周期。我刚才翻了一下这 ...
bobcat 发表于 2009-11-16 19:59


There might be other techniques used to smooth the data before feeding them into the filter. The author always use 1/2(high + low) as the price, to smooth the input a little bit. His tech papers also talked about many other smoothing techniques.

另外,我对dominant cycle比较能够接受,但是根据phase来交易我就不太能接受了,毕竟这个波未必是正弦波,怎么能搞得那么精确呢。
回复 鲜花 鸡蛋

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|www.hutong9.net

GMT-5, 2024-5-17 08:27 PM , Processed in 0.039923 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表