07-08 660


Our Main Categories

There's always a disclaimer in websites. But instead of having the usual legal terms drafted by lawyers, we are just gonna put this in plain English as we like to be casual.

You must know that past performance and future performance are not the same thing. Past performance is a track NewZigzag指标 record of what has happened in the past and future performance might be very different from past performance. Anything that has done well in the past may not do well in future, who knows, right?

You have to use common sense sometimes and know what's real and what's clearly a scam. To our best ability, we put out only legit products and services on our website. You, and you only, have the power to make any investment decision. If you cannot take risk, sadly, any form of investing or trading is not for you. And please. the last thing we NewZigzag指标 want to hear are complains or whining as it just reflects badly on you. You need to understand the risk in Forex and the Financial Market before getting involved.

Python or R, efficient NewZigzag指标 seperate time series into zig zag

I hope to obtain three zig-zag, a zig-zag is defined as local maxima (can be a plateau) and minima (can be a valley), as shown below, there are 3 zig zags, A, B, C while A and B overlap in the plateau, B and C overlap in the valley

enter image description here

I suspect you need to make this a more specific question. Are you just asking for general algos to do this? Have you tried anything?

I am wondering if there is any off-the-self Python or R package already does that, or any fast few line algo to do that.

hi, @JoshuaUlrich I have tried TTR::ZigZag, but for the time series, I have, it sometimes split the end point at the middle of the plateau. and also, if I am not wrong, it interpolates, it doesnt gives the index of the minima and maxima.


zyh的打怪历程 于 2017-12-13 23:23:34 发布 8350 收藏 7

1 2 6
3 5 7
4 8 9

03-29 101

让我们再详细说明这个问题。基本上, 我们得到一个整数数组, 我们需要按以下顺序排列该数组:第一个元素小于第二个元素, 第二个元素大于第三个元素, 第三个元素小于第四个元素, 第四个元素大于第5个元素, 依此类推。简而言之, 输出之字形数组中元素的顺序为[1st <2nd>3rd 5th 7th]。因此, 如果给定的输入数组为[4、3、7、8、6、2、1], 则曲折数组的排列之一将为[3、7、4、8、2、6、1] 。 在我们继续思考如何有效解

10-25 2312

Zig-Zag 在图形图像处理中常常需要将一个二维的图像矩阵转化为一维的向量。二维化一维的过程实际上就是将二维数组的元素按某种顺序构成一维数组。一种常用的序列叫“Zig-Zag”序列,它按以下顺序将二维数组转化为一维数组: 你的任务,就是写一个程序把给定的二维数组按“Zig-Zag”顺序转化为一维数组。 本题中所有的二维数组都是正方形的即行数等于列数。 输入

06-29 36

将一个给定字符串 s 根据给定的行数 numRows ,以从上往下、从左到右进行 Z 字形排列。 比如输入字符串为 “PAYPALISHIRING” 行数为 3 时,排列如下: P A H N A P L S I I G Y I R 之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:“PAHNAPLSIIGYIR”。 请你实现这个将字符串进行指定行数变换的函数: string convert(string s, int numRows); NewZigzag指标 示例 1: 输入:s =.

11-16 1797

AVL树就是一棵平衡的二叉查找树。 其维护平衡的方式是:维护一个平衡因子h,即子树高度,如果左子树高度和右子树高度相差2,那么就旋转把它弄平衡。 旋转是怎么转的这就不细说了,每个PPT都写了。 这个二叉树明显不平衡,可以发现全部左偏,于是右旋。 右旋就是当前节点的左儿子 的 右儿子是当前节点。 如果当前节点有右儿子,怎么办? 那么把这个右儿子拆下来然后装在当前节点的左儿子上。 如图

10-26 3980

爱需要勇气,\textbf <爱需要勇气,>但是也许是天意,\textbf 让我爱上你,\textbf 也许轮回里早已注定,\textbf 今生就该还给你。\textbf 一颗心在风雨里,\textbf 飘来飘去,\textbf 一直都在等待你。\textbf

09-16 1055

形如 1 3 4 10 2 5 9 11 6 8 NewZigzag指标 12 15 7 13 14 16 的数组称谓Z形二维数组。填充这样的数组其实只要按照Z形进行行走填充即可,设置一个flag指示方向,行走的时候检测边界,遇到边界便转换方向。 const int N = 16; void fill_z_ar

12-04 789

点击获取原文链接 学习神经网络的时候我们总是听到激活函数这个词,而且很多资料都会提到常用的激活函数,比如Sigmoid函数、tanh函数、Relu函数。肯定很多人刚开始和我一样一头雾水,接下来就让我们详细了解一下激活函数方方面面的知识。 目录 1.激活函数的概念和作用; 2.通俗的理解一下激活函数(图文结合); 3.几种激活函数的对比; 4.如何选择合适的激活函数? 1.激活函数的概念和作用 概念:神经网络中的每个神经元节点接受上一层神经元的输出值作为本神经元的输入值,并将输入值传递给下一层

07-08 660

前言 二叉树的遍历是一个比较常见的问题,递归实现二叉树的前中后序遍历比较简单,但非递归实现二叉树的前中后序遍历相对有难度。这篇博客将详述如何使用非递归的方式实现二叉树的前中后序遍历,在进行理论描述的同时会附上递归实现以及非递归实现的代码。此外,本文还将描述二叉树的层次遍历以及zig-zag遍历。 一、前序遍历 1、概念 对于一棵二叉树,前序遍历将先遍历根节点,再遍历左子树如果存在的话.

07-06 782

今天看avro ,说zig-zag编码 看了半天终于明白。 value hex 0 00 -1 01 NewZigzag指标 1 02 -2 03 2 04 . -64 7f 64 80 01 . 文档上例子如上面,所以继续编码 那么 -3 的编码是05 3的编码是06, 算法是(n > 31) 来自 http://code.google.com/apis/p.

11-04 1604

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 欢迎使用Ma.

09-11 562

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I

05-08 2262

Pandas: Zigzag segmentation of data based on local minima-maxima

I want to create a zig-zag line connecting between the local maxima and local minima, that satisfies the condition that on the y-axis, |highest NewZigzag指标 - lowest value| of each zig-zag line must exceed a percentage (say 20%) of the distance of the previous zig-zag line, AND NewZigzag指标 a pre-stated value k (say 1.2)

I can find the local extrema using this code:

but I don't know how to NewZigzag指标 apply the threshold condition to it. Please advise me on how to apply such condition.

Since the data could contain million timestamps, an efficient calculation is highly recommended

enter image description here

For clearer description:

Example output, from my data:

enter image description here

enter image description here

My desired output (something similar to this, the zigzag only NewZigzag指标 connect the significant segments)

2 Answers 2

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

I have answered to my best understanding of the question. Yet it is not clear to how the variable K influences the filter.

You want to filter the extrema based on a running condition. I assume that you want to mark all extrema whose relative distance to the last marked extremum is larger than p%. I further assume that you always consider the first element of the timeseries a valid/relevant point.

I implemented this with the following filter function:

To run your code, I first import dependencies:

To make the code reproduceable I fix the random seed:

The rest from here is copypasta. Note that I decreased the amount of sample to make the result clear.

Then we use the filter function:

And plot as you did both your previous plot as well as the newly filtered extrema:

enter image description here


If want to both consider the first as well as the last point as valid, then you can adapt the filter function as follows:

hi, thanks for great answer. Yes your assumption is right " mark all extrema whose relative distance to the last marked extremum is larger than p%.", and both the first and last point should always be considered. I have checked your answer, sometimes it's missed the last point, could you help me on that?

You can use Pandas rolling functionality to create the local extrema. That simplifies NewZigzag指标 the code a little compared to your Scipy approach.

Functions to find the extrema:

The function to create the zigzag, it can be applied on the Dataframe at once (over each column), but this will introduce NaN's since the returned timestamps will be different for each column. You can easily drop these later as shown in the example below, or simply apply the function on a single column in your Dataframe.

Note that I uncommented the test against a threshold k , I'm not sure if fully understand that part correctly. You can include it if the absolute difference between the previous and current extreme needs to be bigger than k : & (ext_val.diff().abs() > k)

I'm also not sure if the final zigzag should always move from an original high to a low or vice versa. I assumed it should, otherwise you can remove the second search for extreme at the end of the function.