如何计算股票图表的趋势线

发布于 2024-10-24 23:25:42 字数 123 浏览 3 评论 0原文

我已阅读主题:如何计算图表的趋势线?

我正在寻找的是如何找到接触图表外部极值点的线。预期用途是计算股票图表的支撑线、阻力线。所以它不仅仅是一个简单的回归,它还应该限制接触点的数量,并且应该有一种方法来找到相关的区间。

I have read the topic: How do I calculate a trendline for a graph?

What I am looking for though is how to find the line that touches the outer extreme points of a graph. The intended use is calculation of support, resistance lines for stock charts. So it is not a merely simple regression but it should also limit the number of touch points and there should be a way to find the relevant interval.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽清梦 2024-10-31 23:25:42

您可以考虑使用一种计算数据凹包的方法。您可能可以找到现有的 python 实现。这将为您提供包含时间序列的边界。如果您希望排除数据集中的异常值,则可以在计算凹包之前对数据应用某种过滤或平滑。我不是 100% 确定“限制接触点数量”和“找到相关间隔”是什么意思,但希望这能让您开始。

You could think about using a method that calculates the concave hull of your data. There are probably existing python implementations you could find. This will give you the boundary that encloses your timeseries. If there are outliers in your dataset that you wish to exclude, you could apply some sort of filter or smoothing to your data before you calculate the concave hull. I'm not 100% sure what you mean by "limit the number of touch points" and "find the relevant interval", but hopefully this will get you started.

归途 2024-10-31 23:25:42

我会像数学一样对待它。首先,创建图形列表(可选)或仅创建一次所有点,一次 x 和 y。然后,具有适当条件的函数。

例如:这并不是真正的解决方案。

import random

class StockCharts():
    x_line = []
    width = 100
    height = 100

    def startgen(self):
        for y in range(0,self.height):    
            zeile = []
            for x in range(0,self.width):
                zeile.append(random.randint(0,100))
            self.x_line.append(zeile)


    def analyse(self, x, y):
        starty = max([0,y-1])
        endy = min([y+1,self.height-1])
        startx = max([0,x-1])
        endx = min([x+1,self.width-1])
        num = 0
        for sy in range(starty, endy+1):
            for sx in range(startx, endx):
                pass # her you can write your if-clauses


    def showgen(self):
        for y in range(0, self.height):
            print self.x_line[y]
        print



stock = StockCharts()
stock.startgen()
stock.showgen()

I would approach it just as in mathematics. First, create the graph list (optional) or only once all the points, once x and y. Then, a function with the appropriate conditions.

For example: it's not really a solution.

import random

class StockCharts():
    x_line = []
    width = 100
    height = 100

    def startgen(self):
        for y in range(0,self.height):    
            zeile = []
            for x in range(0,self.width):
                zeile.append(random.randint(0,100))
            self.x_line.append(zeile)


    def analyse(self, x, y):
        starty = max([0,y-1])
        endy = min([y+1,self.height-1])
        startx = max([0,x-1])
        endx = min([x+1,self.width-1])
        num = 0
        for sy in range(starty, endy+1):
            for sx in range(startx, endx):
                pass # her you can write your if-clauses


    def showgen(self):
        for y in range(0, self.height):
            print self.x_line[y]
        print



stock = StockCharts()
stock.startgen()
stock.showgen()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文