Single Study, Multiple BarSizes

Novatago

New member
Joined
Feb 28, 2023
Posts
3
Likes
1
Is it possible for a single Study to access multiple different BarSize series using multiple dataContext.getDataSeries()?

I'd like to build a SINGLE study, that calculates a set of moving averages, each based on different BarSizes (ie, 1m, 5m, 15m, etc).

The calculations need to be in a single study because I also want to compare values using a pattern detection algorithm.

It seems that if I get a DataSeries for a particular bar size, the chart itself must be set to that size. For instance, if I use:

Code:
DataSeries series = dataContext.getDataSeries(BarSize.getBarSize(BarSizeType.LINEAR, IntervalType.MINUTE, 60));

Then, I'm only able to have access to this series when the underlying chart is set to 1H (60 mins).

I'd like to be able to do something like this, in a SINGLE study applied to a 1 min chart.

Code:
DataSeries series1 = dataContext.getDataSeries(BarSize.getBarSize(BarSizeType.LINEAR, IntervalType.MINUTE, 1));
DataSeries series2 = dataContext.getDataSeries(BarSize.getBarSize(BarSizeType.LINEAR, IntervalType.MINUTE, 5));
DataSeries series3 = dataContext.getDataSeries(BarSize.getBarSize(BarSizeType.LINEAR, IntervalType.MINUTE, 15));
DataSeries series4 = dataContext.getDataSeries(BarSize.getBarSize(BarSizeType.LINEAR, IntervalType.MINUTE, 60));

Is this possible?
 

mattmar10

Active member
Joined
Jan 21, 2023
Posts
26
Likes
12
Yes, you can do this. Send me a PM and I can point you in the right direction. I'm doing it for a couple of my custom studies.
 

mattmar10

Active member
Joined
Jan 21, 2023
Posts
26
Likes
12
i use multiple time frames in this study... hopefully this helps
 

Attachments

  • FVG.java.txt
    12.2 KB · Views: 10
Top