In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use Python to achieve MACD drawing", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use Python to achieve MACD drawing" this article.
The code is very simple:
ChartCfg Chart configuration Dictionary
What is stored in this ChartCfg dictionary variable is chart configuration information, such as: how many lines are there in this chart? (three indicator lines, DIF, DEA, MACD, respectively) is there a K line in this chart? The type of 'type':' candlestick' is set to K-line data. MACD values are relatively small, if the trading pair is BTC_USDT, the indicators will be compressed together when drawing is very inconvenient to see, so the chart should also be configured for 2 Y axes. (so there are two Y-axis configurations in 'yAxis', one is the indicator axis and the other is the K-axis)
Load data
In this example strategy, the main function starts initializing the chart, calling the Chart function, passing in the chart configuration ChartCfg as a parameter, and generating a chart object chart. Then enter a cycle, constantly get K-line data, and judge that as long as the number of BAR of K-line data is greater than 50, you can calculate the MACD index (BAR is too little to calculate the effective index). Then the K-line data and index data can be written into the chart.
The method add function of the chart object is used to write the chart.
When writing, if you specify the last argument of the add function,-1, to update the value of the current data point. If you do not pass-1, add a new data point. When the K-line BAR is newly generated, a new data point is added, and when the K-line BAR is not generated, the last BAR and the corresponding indicator are updated. (judged by the time stamp comparison of K-line BAR)
It can be tested back directly.
It can also be run on a firm offer:
The above is all the content of the article "how to use Python to achieve MACD drawing". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.