-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ohlc scale #94
base: master
Are you sure you want to change the base?
Ohlc scale #94
Conversation
fix last_td computation.
format.
add timeframe sample to gallery.
Hi @DaTrader - you've been busy! There's a bit to take in here. First up, I really like the option to be able to explicitly set tick intervals. I think we can probably do better than directly interacting with the struct from The With the steps option - is this not redundant if the tick interval can be explicitly set? Or am I misunderstanding the interactions of timeframes & zoom levels? |
Re Re Re
|
Aha moment for me re: What about if we had With the timeframes, they are a bit specialised to financial charting. Are you likely to create a separate volume chart too? If so, I'm thinking we move the financial specific bits into a specialist scale that could be shared between them. If not, it's probably best to keep the timeframe functions in with the OHLC chart. I don't have much time over the next couple of days, but happy to take on these, or happy for you to - let me know! |
I haven't figured out how to use the This weekend I'm going to focus on completing the todos in the Volume is typically optional and when displayed it's an overlay chart limited in height relative to the bar/candlestick chart it is displayed in. Note that displaying the volume does not affect the value axis. The reason for this is the same as for why it is so common to make the timescale show only some of the labels having the aesthetics matter more than information - it is because all such charts are pointer sensitive. When hovering over candles with the mouse pointer, or over the candle close border as in MT4, a tooltip should be shown with the OHLC and volume values. This is something that needs to be done yet. However, more important than volume are the so called indicator and oscillator charts, with the former being of more importance to me personally. Indicator charts are simply full chart overlays that share the same X and Y axes with the main (price action) chart. Oscillator charts are charts that share just the time scale and get optionally inserted together with their own value axis vertically between the price action chart and the time scale. Last but not least is a free style (trend-)line and trendline based indicator drawing tool. |
I just noticed the entire dataset is present in two different places in
`%OHLC{}` - one instance as its direct field and another in the mapping.
Why is that?
…On Wed, Feb 7, 2024 at 7:28 AM mindok ***@***.***> wrote:
Aha moment for me re: step... - the idea of tick_interval in Contex (and
other generalised charting packages) is to determine how often to display a
tick on the axis, and interval_count refers to the number of labels
(approximately) that you want on the axis. It refers only to the scale &
axis, and not to the data. I think this be a naming clash with the meaning
of tick in financial charting.
What about if we had data_interval to indicate what each candle
represents (this would be a time_frame_xxx). The tick_interval would then
be calculated using the logic you currently have using data_interval,
width and zoom, and step would go away. This maintains the existing
meaning of tick_interval but gives you what you need.
With the timeframes, they are a bit specialised to financial charting. Are
you likely to create a separate volume chart too? If so, I'm thinking we
move the financial specific bits into a specialist scale that could be
shared between them. If not, it's probably best to keep the timeframe
functions in with the OHLC chart.
I don't have much time over the next couple of days, but happy to take on
these, or happy for you to - let me know!
—
Reply to this email directly, view it on GitHub
<#94 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHGBECZ7HBPHZYDZGT37XYTYSMNKBAVCNFSM6AAAAABCZDDXPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZRGM3TENZZG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
plot just a single border line if body_width is 0; fix bars so they correctly account for body_width.
Hey @mindok, can you please check my previous questions here from 2 weeks ago? In addition to those, I now see that some charts are using this I am asking this because I'm now looking into adding the chart overlays (like a line chart over the candlestick chart). I'm thinking about adding the feature to the What say you? UPDATE: I realized the Now, the question remaining is whether I go for implementing overlay charts as part of the OHLC chart only, or you can jump in and create a new fixed spacing TimeScale based on what I've so far implemented in the |
reuse datetime accessor.
Hi @DaTrader, re: the mapping / dataset - the mapping came in much later than the original dataset concept where column names were mapped to chart features via explicit functions.
The external API for a plot is still better off looking like this IMO (i.e. mapping is an option for a chart of some data), particularly as mappings aren't required to be specified in certain circumstances:
I'd suggest you do your overlay charts without waiting for me - I'm up to my neck in other stuff at the moment. If you add a couple of gallery charts to illustrate key points (e.g. how the time frames work etc), I will make sure they don't break during a refactor. |
@mindok Yeah, I am aware of the Erlang feature and wasn't really worried about the memory but about the inconsistency b/w the two dataset instances and the need to apply any update operation to both of them. I am saying this because I am trimming (updating) the dataset in the fixed spacing mode b/c there's no point of holding or displaying more candles than can fit in visually (as the initially supplied data array can be "infinite"). Also, this remedies the side effect of an extra candle being drawn outside of the data area. |
@mindok I've drafted the overlay implementation with Simple Moving Average as an example. What it takes now is for you to see how to optimize/provide more flexible access (if at all). My concern is the way I am extracting the LinePlot SVG path markup in the Note that I no longer trim OHLC data to display it properly. Instead I use the domain time window with a modifiable start (domain_min) so the user can choose which part of the chart is shown. Besides, this is mandatory for proper computation of (some) indicators relying on past values - also the reason why SMA start is shifted to the right by the amount of |
lib/chart/ohlc/ma.ex
Outdated
y_transform: render_config.y_transform | ||
] | ||
|
||
Plot.new(dataset, Contex.LinePlot, 100, 100, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - I think we should be able to do better than this! I'll see what makes sense in terms of exposing parts of the line plot so you don't have to generate the whole thing and then pick bits out.
Thanks @DaTrader - I've been contemplating what Contex 2.0 looks like (even though 1.0 hasn't be released!!). Moving to Phoenix function components for all aspects of rendering is looking pretty attractive, and the overlay that you have built here is a perfect example of why I'm considering this approach. I added a comment to your code - you don't need to action - it's more of a reminder to myself. I think we can expose some of the internals of line plot to make it easier to reuse. |
@mindok I fully agree. In order to be efficiently usable, it will require the ability to selectively update/render only parts of the chart, i.e. in case of Btw, take a look here at the first glimpse of It depends on AlpineJS, so make sure you go to Keys:
|
@mindok Btw, at some point you'll need to make the X and Y axes non-transparent and above the data chart to prevent the following from happening: PS. I can prevent this particular one by taking into account the overlay (the moving average in this example) values when the Y axis is computed. |
Nice job @DaTrader! The overlay has come out well. It's really useful to see a full example and gives a good target to test against with some of the rearranging proposed above. WRT Phoenix Components - maybe optionally handling the stream approach would help with pushing / popping individual data points from what's rendered. Working around the constraints will be a challenge though. |
optimize rendering loop; make optional domain (visible candles) window based y scale computation.
Add fixed spacing and timeframes