- ago
When creating a Custom Indicator the Indicator Builder proposes you a choice...
TimeSeries or a BarHistory type. This represents the source data that is used to populate the Indicator or at least to synch its data to the symbol being charted or processed.
Is there an advantage of one vs the other? BarHistory seems to be more popular amongst forum members. If not what are the preferences for usage? Thanks.
0
442
Solved
11 Replies

Reply

Bookmark

Sort
- ago
#1
Its not a preference, but a decision based on what data you want your custom indicator to process. For example you could have a custom indicator that takes as its source a BarHistory. That would give it access to the bars' Open, Close, etc., but that is particular to a BarHistory. However, you can't provide something like a moving average (e.g. SMA) because that is not a BarHistory.

Instead if your custom indicator takes a TimeSeries as its source, you can provide, say, an SMA (or any TimeSeries). But, you can't provide it a BarHistory because a BarHistory is not a TimeSeries. Both TimeSeries and BarHistory inherit from TimeSeriesBase. They're siblings.

For more info: https://www.wealth-lab.com/Support/ApiReference/TimeSeries and https://www.wealth-lab.com/Support/ApiReference/BarHistory and https://www.wealth-lab.com/Support/ApiReference/IndicatorBase
1
Best Answer
Glitch8
 ( 7.81% )
- ago
#2
Exactly, and if your indicator doesn't need a BarHistory (doesn't need OHLC, but can be applied to just one data series) then use TimeSeries. Because if you use BarHistory then you won't able to apply your indicator onto ANOTHER indicator, like you can apply an SMA or EMA to an RSI or a CMO.
3
- ago
#3
Thanks for the info. I see it now. You can actually see which type the indicators use in the pane below the Indicators panel.



0
Cone8
 ( 24.56% )
- ago
#4
... and also in the intellisense when you're typing in any parameter list.

0
- ago
#5
Is there a reference article in the documentation where it explains when to use TimeSeries or BarHistory when creating an indicator? It seems that if the indicator is to be plotted on the price pane it uses BarHistory ond if on its own pane TimeSeries but I've seen them both ways. "Only indicators which need access to O/H/L/C/V have a BarHistory as input" I think you can use OHLCV in the Price component under AddParameter. Thanks.

CODE:
protected override void GenerateParameters() {          AddParameter("Source", ParameterType.TimeSeries, PriceComponent.Open);
0
- ago
#6
Moved your latest and duplicate post from another topic.

QUOTE:
Is there a reference article in the documentation where it explains when to use TimeSeries or BarHistory when creating an indicator?

You have already asked this question, please see paul1986's answer above.
0
Cone8
 ( 24.56% )
- ago
#7
QUOTE:
It seems that if the indicator is to be plotted on the price pane it uses BarHistory
That's a misconception. You can assign a new pane to the PaneTag for your indicator or the "Price" or "Volume" pane. See User Guide (F1) > Indicators > Custom Indicators

If you need more information about specific fields, the details are the same as those here: https://www.wealth-lab.com/Support/ExtensionApi/IndicatorLibrary
0
- ago
#8
Hi Eugene, Thanks for the info. The links provided only show me TimeSeries and BarHistory for Strategy creation and example codes for it. But my question was on creating custom indicators which I do not see any examples in the links provided.
The only custom indicator examples I see are the SMA, RSI and ATR. in the Custom Indicator Builder. As far as the access to Open, Close, High etc. both TimeSeries and BarHistory can depending where you place the OHLC. See images below. Correct me if I'm wrong. Thanks.



0
- ago
#9
Either I don't your question the way it is formulated or what you're looking for is the PaneTag property. See link in Cone's reply. It controls the pane where your indicator should be rendered.
0
Glitch8
 ( 7.81% )
- ago
#10
The TimeSeries-based indicator can access only ONE of the OHLC/V items, and the "High" that you called out there is just the default value. It could also use another indicator, like an RSI, as a source.

The BarHistory-based Indicator can access all 5 OHLC/V items, not only one of them.

A BarHistory-based indicator, however, CANNOT be based on other indicator as a source. For example like the SMA which can use another indicator like RSI as its source.
1
- ago
#11
QUOTE:
A BarHistory-based indicator, however, CANNOT be based on other indicator as a source. For example like the SMA which can use another indicator like RSI as its source.


Thanks I can see now when you can use one over the other.
0

Reply

Bookmark

Sort