I am trying to improve my financial research workflow and need some help figuring out how to create some custom charts/visualizations.
I don’t like my current mish-mash of C++, R, Python, and some proprietary charting package that requires a subscription. And I especially don’t like that my statistical visualizations don’t work the same way as the technical analysis ones that display the results, or that I often have to compute the data for any given visualization 2 or 3 times in different languages. That is a source of too many bugs.
It looks like Julia could solve my problem. But I can’t figure out how to use it to make a custom technical analysis chart. Displaying Open-High-Low-Close (OHLC) bars seems pretty straightforward. And overlaying some indicators or adding a volume chart at the bottom and the side doesn’t seem that hard either.
But how do I write code that can create other types of charts? Like Point and Figure, TPO, Kagi, Renko, three-line break, etc.
The only open source software I’ve found that can do even some of this is mplfinance, but it only works with data that is already in an OHLC format, and I’m specifically interested in charts and visualizations that work directly from raw tick-data. And I often want something customized that merges the technical analysis chart with a statistical visualization. (E.g. A TPO chart that uses kernel density estimators; or a P&F chart that has some fractal statistics overlaid. Or a quasi-OHLC chart that is using splines made from the tick data. etc.)
Can someone help me get oriented with how Plots or the other relevant packages work and what I need to do to create my own visualizations that combine some kind of (perhaps custom) technical analysis tick-data chart with a statistical plot?
Anytime I want a highly-customized chart, I go back to D3.js. It’s a bit of an investment to learn, but the sky is the limit in terms of what you can create with it. In the Julia world, I’ve found myself lately gravitating towards Makie.jl when I want a higher degree of control/customizability. However, given the information you’ve provided, I don’t think Julia can solve your problem. Others will hopefully chime in if they feel differently but I really think you should consider taking the dive into D3 since it sounds like you have needs that exceed what any single plotting library is going to provide.
Makie looks really promising. From looking over the documentation, it seems like I could create some custom plot recipes or other types and get what I want, but it would require a pretty deep dive into how that pipeline works.
Is there a reason you don’t think it would be a solution? Like is there a limitation in how the pipeline works that would make it hard to do what I need?
All of the commercial packages are written in very optimized C++ code and given that those stress out both CPU and memory on most computers as-is, I’m hesitant to invest the effort to learn something as complicated as D3.js given the performance concerns.
It seems like I’ll end up spending a lot more time dealing with how to move the data around from the code going the calculations and aggregating to the code doing the displaying. (Which is the problem I have now.)
I’ll look into it. But it seems like Makie could be a good fit since it sits on top of OpenGL.
Ideally the mplfinance library should be ported over to Julia or at least have some sort of wrapper around it. If you think it is worth your time and useful going forward, maybe you can give it a shot.
In terms of plotting, my guess is that nothing native in Julia will suit your needs. I have not used Makie, but probably nothing else can handle tick-level data sets. On that front, I have considered creating a wrapper to https://github.com/tradingview/lightweight-charts which is a new entrant to the arena but probably one of the best options out there. If someone was going to port a high-performance charting library to Julia, it’d be my suggestion.
To clarify, I’m not asking for recommendations on a technical analysis charting package that I can use. I know that Julia doesn’t have one. I’m asking for advice on how to make one. If I wanted to interface to an existing package, I would just pick a commercial C++ library and do exactly that.
This stuff is not complicated, I just don’t know how plotting works in Julia well enough to do it and would like some help getting started.
It seems like Makie is going to work better than Plots. So what’s the best way to get acquainted with it? The ultimate goal would be to produce something as nice looking as TradingView’s stuff. But in the near-term I just want to know how to use it well enough to display the charts correctly and then overlay some statistical plots on top of them.
mplfinance does this in under 2000 lines of code. Even if we double the code to add the functionality I need and to deal with my data format, it’s still trivial.
I just don’t know how to use Makie to accomplish the same result. Let’s start with something simple: if I have my data in open-high-low-close format, how can I display that chart as either bars or candlesticks?
Some variation on that code should probably work for 90% of the other chart types. (And this is how mplfinance works internally. For any other chart type, it creates a fictional time-series with appropriate axes. Even though this code isn’t in the open source version of trading view, my understanding is that they use the same approach. MarketProfile/TPO will be more difficult. And a few of the others have some gotchas. But we can cross that bridge when we get there.)
Thanks for clarifying the question! I think what you’re looking for is absolutely possible in Julia, and Makie is a good place to start. You might find the #makie channel on the Julia slack useful for communicating directly with Makie experts.
I had trouble finding good candlestick plotting in the julia ecosystem, but luckily there is a julia vega implementation (https://github.com/queryverse/VegaLite.jl) which I used to draw candles and Bollinger bands
I find vega to be pretty magical in its ability to always render a “good” looking chart. You can check out my notebook here where I was playing with adding additional technical indicators via raw vegalite json.