4.1 量化论文“Automatic one two three”的复现

思考

1.为什么写量化博客?

根据我个人的理解,量化的思路可以分为几种,因子模型资产组合,高频交易套利,技术分析。
因为本人的知识储备与专业水平有限,初步打算先从技术分析入手,进行逐步学习。并将学习内容分享到网络,用以对抗自己的拖延。

2.为什么先入手技术分析?

技术分析是否有效还未得到验证,但通过我略微了解过过一些观点:如人类喜欢跟随热点,借贷过度消费 等原因应该是能导致趋势和经济周期的产生,如果我的理解是正确的,那么一定有办法通过技术分析捕捉到趋势与周期。

3.为什么想要复现这篇论文

从这篇文章中找到的方向【干货】Quantitative Finance 杂志关于量化交易领域排名前十的文章
因为这篇文章是英语的,读起来比较费劲,但是我又非常想理解其中的内容,自己一句句翻译再去读读到一半就坚持不下去了,陆陆续续过了两三周都没有什么进展,所以通过写博客的形式进行总结反馈。
这篇还有不少工具元素值得我去学习,比如说信号的过滤等内容,希望通过学习其中的方法,理解运用到实战中去,实战才是最终的目的。

4.下一步计划

初步打算先把这篇文章复现出来,因为刚刚开始学不懂的非常多,请有缘看到这篇文章的大佬多留言,多知道,给我一些学习的指引,拜托了。

废话不多说,开始吧。

全文阅读与理解

《Automatic one two three》 ,Stanislaus Maier-Paape

在本文中,我们展示了如何使用停止和反向过程从基础价格过程中自动计算出市场技术趋势。最基本的工具是一个所谓的最小最大过程,显示所有相关的最小值和最大值。对于最小极大值过程的存在性,我们给出了一个建设性的证明。基于这个1-2-3的趋势指标,可以自动实施几种成功的趋势跟踪交易策略。

1、设计工具minmax process
2、通过工具minmax process 、与ohlc数据,生产出123指标数据
3、通过123指标实施几种交易策略

1. Introduction(简介)

回到Charles H. Dow,趋势的概念是交易金融市场的核心(cf. Russell 1981)。我们使用(市场技术)趋势定义如下:

Definition 1.1 (定义)

(市场技术趋势)如果最近(至少两个)连续的相关低点和高点都在上升,金融市场就处于上升趋势。准确地说,我们假设所有的低点都是单调增加的,高点甚至都是严格单调增加的。类似地,当最后一个相关的低点和高点都在下降时(低点甚至严格地单调减少),就会出现下降趋势。如果既没有上升趋势,也没有下降趋势,市场被称为无趋势。

趋势:最近至少两个高点上升 and 最近至少两个低点上升
反之无趋势

Remark 1.2 (备注)

上述定义允许上升趋势中的低点在同一水平上,而上升趋势中的每一个新的高点必须严格高于前一个高点。如果在活跃的上升趋势中,下一个高点与上一个高点处于同一水平(甚至低于),这通常是一个看跌信号。我们将这种情况称为“有问题的趋势”(详见第3节定义3.1)

1、低点可以水平,高点必须更高
2、上升中出现高点处于同一水平(甚至更低)→“有问题的趋势”→看跌

Definition 1.3

在上升趋势中,最小值和下一个(更高)最大值之间的阶段称为移动,而最大值和下一个(更高)最小值之间的阶段称为修正。在下跌趋势中,移动和修正的定义类似(镜像)。

movement:同大趋势方向
correction:逆大趋势方向

虽然这个定义乍一看非常直观,但它在两个方面存在问题。
首先,有关高低的概念对观察者来说是主观的。对于一些观测者来说,只有大极值是相关的,而其他观测者认为小极值也是相关的。这种敏感性问题不仅存在于人类身上。即使是数学上精确的定义也无法解决这个问题,如图2所示。
连续过程在左侧图中凹出一个新的最小值,直到最小值可以清楚地识别为两个相关极大值旁边的相关最小值(右侧图)。由于这一过程是连续的,从什么时候开始这个新的最小值是相关的决定必须是主观的。
定义相关极值的另一个问题是时间尺度。很明显,在10分钟柱状图上,与日柱状图甚至周柱状图相比,会出现更多的极端情况图表。因此,我们的立场是,市场是否处于趋势,这个问题的答案取决于我们所观察的时间尺度。
例如,一个市场可能每天都在对一个明显的上升趋势进行修正,而与此同时,这个市场每小时都有一个下降趋势(参见图3)。为了进一步参考,我们介绍了趋势中相关极值的编号,例如Voigt(2008)。

存在两个问题:
1、主观转化为量化、凹形形态无法避免主观性
2、时间尺度,固定时间尺度

Definition 1.4

(1-2-3-趋势编号)在上升趋势中,最初的最小值用1标记,随后的最大值用2标记,下一个(更高的)最小值用3标记。更大的最大值(最小值)也用2(3)编号(参见图1)。
相同的编号,但镜像,用于下降趋势(参见。图3)。在续作中,我们通常会提到点2或点3,即处于这些极端的价格水平。

标记方法:1 23 23 23 23 23

2.8 minmax 基础策略

Basic MinMax Strategy 2.8.
Whenever Status[0] = +1,
we search for a relevant maximum, and
whenever Status[0] = −1,
we search for a relevant minimum.
At this point we still have to discuss how the exceptional
situations may end. Assuming again the situation of figure 11,
there are two possibilities:
(i) The prices continue to fall and eventually the direction
changes to −1.
(ii) Thepricesstartrisingagainandexceedeventuallyabove
the last relevant maximum that had to be fixed on entry
of the exceptional situation.
In both cases, we switch back to normal, i.e. in case (i)
we just change Excep[0] back to 1 (yielding Status[0] =
−1) and in case (ii) we change Excep[0] back to 1 (yield-
ing Status[0] = 1) and additionally fix the recently found
minimum, i.e. we continue to search for a new maximum.
For definiteness, we give the update of the Excep series
once the last relevant maximum (at absolute period number
lastmaxbar) and the last relevant minimum (at absolute
period number lastminbar) have been found:

定义2.9 更新Excep序列

Definition 2.9 (Update Excep series)

If Excep[1] = −1 then
// exceptional process was already active
Excep[0] :=1 , in case Direction[1] · Direction[0] = − 1 
						or Direction[1] = 1 and High lastmaxbar≤ High[0] 
						or Direction[1] = −1 and Low lastminbar ≥ Low[0],
				  −1 , otherwise

else if Direction[1] = Direction[0] then
// check for exceptional situation
Excep[0] :=−1 , in case Direction[0] = 1 and Low lastminbar ≥ Low[0] 
										or Direction[0] = −1 and High lastmaxbar ≤ High[0]
					1,otherwise

In the following we use the convention that in case
Status[0] = 1, the last fixed relevant minimum
occurred in the period lastminbar
and the temporary maximum
afterwards is in the period tempmaxbar.
Similarly, in case
Status[0] = −1, the last fixed relevant maximum
occurred in the period lastmaxbar
and the temporary minimum afterwards
is in the period tempminbar.
Hence
lastminbar ≤ tempmaxbar and lastmaxbar
≤ tempminbar (if $Choice = 0)
or lastminbar < tempmaxbar and lastmaxbar
< tempminbar (if $Choice = 1)
are all absolute period numbers. Depending on whether we
allow minima and maxima to occur in the same period, we
get different processes of minima and maxima. This will be
modelled with the parameter $Choice. We will see later that
only $Choice = 0 yields a minmax process satisfying all
criteria of Definition 2.6.
In order that Definition 2.9 is well defined, we need to know
what lastmaxbar and lastminbar is. These two bars can
only be defined after the SAR process has finished initializing
(say Direction = 0 while initializing).

定义2.10(最大最小过程的初始化)

原文:
Definition 2.10 (Initial MinMax process)

	If Direction[1] = 0 and Direction[0] = 1 then 
		lastminbar := period of lowest low of all	periods loaded so far.
	If Direction[1] = 0 and Direction[0] = −1 then
		lastmaxbar := period of highest high of all periods loaded so far.

In both cases, we start with Status[0] = Direction[0], i.e. Excep[0] = 1.
Having fixed, e.g. the last minimum at lastminbar, tempmaxbar is the period of the highest high after lastminbar as long as Status[0] = 1.

We therefore can now state how we update the minmax process.

翻译:
方向从0→+1/-1,固定最大最小值

  • 如何将序列固定 #2疑问
    这两种情况下,我们从Status[0] = Direction[0] 开始, 即 Excep[0] = 1.
    通过固定,例如lastminbar的最后一个最小值,只要Status[0]= 1,
    tempmaxbar就是lastminbar之后的最高值。
    因此,我们现在可以说明如何更新极大极小的过程。

定义2.11 (最小最大过程的更新)

Definition 2.11 (Update MinMax process)
伪代码

// Definition 2.11 (Update MinMax process)
If Status[1] = 1 then
	begin
		if High(tempmaxbar) ≤ High[0] then
			//update tempmaxbar
			tempmaxbar := CurrentBarIndex()
		if Status[0] = −1 then
			//Status has changed; fix the last maximum
			begin
				lastmaxbar := tempmaxbar
				tempminbar := bar of lowest low with lastmaxbar + α ≤ tempminbar ≤ 
				CurrentBarIndex(),
	where
		α :=
			1, if($Choice = 1) or(lastmaxbar = lastminbar)
			0, otherwise
			end
	end
if  Status[1] = −1 then
	begin
	if Low(tempminbar) ≥ Low[0] then
	//update tempminbar
		tempminbar := CurrentBarIndex()
	if Status[0] = 1 then
	//Status has changed; fix the last minimum
		begin
			lastminbar := tempminbar
			tempmaxbar := bar of highest high with
			lastminbar + α ≤ tempmaxbar
			≤ CurrentBarIndex()(24)
		//where α is defined as in (23)
		end
	end

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值