Building custom ChartStyle with tick data
Author: Rebelion
Creation Date: 8/30/2013 7:20 AM
profile picture

Rebelion

#1
Hello. Now trying to write my own Chart Style via the instuction from the site and example project. Have a trouble: I have tick data and, of couse, LeftEdgeBar and RightEdgeBar return me number of tick between left and right corners of the price pane (based on BarScale parameter). But I form my candles using many ticks - one candle can contain >1000 ticks. But RightEdgeBar - LeftEdgeBar usually less than 200-300 ticks. Trying to use ConvertValueToY I get, of couse, values that cannot be used for visualize candles correct (for example, 200-300 ticks may have highPrice - lowPrice < candleSize - parameter I use to form my own candles). And I can't reflect it for changing - these both are Properties. What logic could you recommend me for realizing to get round this problem?
Thnxs.
profile picture

Rebelion

#2
Ok, ask another question - is there any "deep" manual for Chartsyles? For example, what does "HiddenHeight", "MinValue", "MaxValue" mean?
profile picture

Rebelion

#3
And, so, How should I renew all indicators, plotted on my Chart?
profile picture

Eugene

#4
QUOTE:
is there any "deep" manual for Chartsyles?

None except this - Creating Chart Styles for Wealth-Lab Pro®.

QUOTE:
How should I renew all indicators, plotted on my Chart?

Wealth-Lab does that.
profile picture

Rebelion

#5
Emmm... So, It's no way to replace base data series in the indicator, plotted on the my Chart? Cause If I plot it by drag and drop, so It take the tick Bars as a base for calculations, not my Bars I've created before. And I do not have any instruments to change it without reflection now? What's the better way, guys?

Thanks.
profile picture

Rebelion

#6
CODE:
Please log in to see this code.


No changes in EMA, for example, after this code (I added 1 indicator for testing). I suppose, I need to call same renew method for rebuilding indicators after "base" dataseries changing, yes?
profile picture

Cone

#7
QUOTE:
But I form my candles using many ticks - one candle can contain >1000 ticks.
We should make sure that you're not doing something that is already done. The Data Loading Control can already scale "tick bars", in other words, you can configure a n-tick bar chart.

QUOTE:
But RightEdgeBar - LeftEdgeBar usually less than 200-300 ticks.
This is not a constant and depends on the bar width selected in the U.I. and whether or not the ChartStyle actually displays the bar(s).

QUOTE:
no way to replace base data series in the indicator, plotted on the my Chart?
The important point to keep in mind is that a ChartStyle doesn't change the Bars object that your script will use. To change the Bars object, you need to build a data adapter.

I could probably help more if I knew the requirements of your ChartStyle.
profile picture

Rebelion

#8
Hello, Cone.

I need something like this: I have ticks data and I need to form my own candles from tick (for example, renko or other type of candles, based on my own algorithms). I need to stack ticks data in candle, but one candle can consists of 100, 200 and more ticks, this value can be extremelly variable - linked with a volatility level.
So, I get Bars object which consists of ticks data. I form my candles, plot it (I can't use LeftEdgeBars and RightEdgeBars, because they based on ticks, not on my own candles). But when I try to plot any indicators, I have it plotted in base of ticks data, not on my own candles. Indicators (classes) have no methods to renew internal data series and whe I try to change data series through reflection, I have no result. What should I do?

Thnxs.
profile picture

Cone

#9
You can use Left/RightEdgeBars, but you have to override InitializeBarWidths() and set the bar widths of the ticks to zero for the ticks that you are not going to plot. In other words, you might have 999 ticks that have zero width, but the 1000th tick is a conflation of all the previous ticks that has some width - which should probably be ChartStyle.BarSpacing.

That's the easy one. As I mentioned before, you can't create indicators based on a ChartStyle directly, so you have to be creative. There are 3 ways I can think of to go about it.

1. Forget about the ChartStyle API and create your own data adapter that conflates the data required by your ChartStyle. This should work as long as your ChartStyle can be be represented adequately by one of the built-in methods, like Line, Candle, or Bar charts. The great advantage is that the Bars object will be native to your style and you can 1) apply indicators to it directly, and 2) generate trading signals using those base bars.

2. Make a public class/collection that defines your ChartStyle so that you can access it in your script (and use it in the ChartStyle itself as do the Trending ChartStyles: Point and Figure, Renko, Kagi, and Line Break). Then you can theoretically create an unsynchronized Bars object to which you can apply indicators and later Synchronize() them to the base Bars. Remember, trading must occur in the base (ticks) scale, which will be okay as you are ignoring the ticks that the ChartStyle doesn't plot.

3. If you know which indicators you need beforehand, you can build them into the aforementioned class object that you retrieve in the script.. certainly the least flexible solution.

This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).