src/Deepchart/Data/HigherTimeframeCandles.cs · Calculated on: desktop or server (on the server only the resolution of the chart is available for now)
The 30 minutes bars on a 5 minutes chart, or any other resolution the user chooses, drawn in an area of their own. Each candle is as wide as the bars of the chart it covers, and its colors come from its delta.
What it shows
RequestResolutioninOnInit, and the totals of another resolution.- How to find the bar of the resolution a bar of the chart belongs to.
- A candle drawn as an annotation across several bars, and a series with four values per point.
ForceHidden: a series which holds the values but is not drawn.
The request
BasedOnMinute), which is lighter than the trades. The filter asks for the totals of the bars, which another resolution does not have by itself. Nothing is read here: the bars arrive with the history. See Other resolutions.
Following the bars
At every call the indicator looks for the bar of the resolution the current bar of the chart belongs to, by exchange time:index + 0.5 to index + 1.5: a candle from 0.6 to 1.4 leaves a small gap on each side. Update then writes the values of the bar as it is now: open, close (Y and Height), low (Y2), high (Y3), and moves X2 to the current bar.
The colors
Border by open and close.
Things to notice
- With the Candlestick style the series is
ForceHidden: it holds the four values of every bar, and gives the axis its range, but the candles are the annotations. With the Line style the series is drawn and shows the close. - The area is a new one:
OnSetputs the indicator in area 2 the first time, and the axis takes the tick size and the decimals of the symbol from the first bar found. - In the history every bar of the resolution is already complete: the candle of a 30 minutes bar has its final values from the first 5 minutes bar it covers. Fine for drawing, not for a signal. See Looking ahead.
- Daily bars with the days of a minutes chart are few: raise
Days to load. OnEndwidens the axis to the last candle: the annotations do not count for the automatic range.
Try
- Add a second resolution and write its close in a label.
- Hide the candle of the bar of the resolution still open, and show only the complete ones.
- Ask for the 1 minute bars on a tick based chart, and count how many minutes each bar of the chart covers.