Hello,
i was wondering if it might be possible to have an indicator perform on another individually adjustable timeframe, independent of the timeframe the current chart is set to? e.g. chart is set to 1000 ticks however indicator is based on 5 min.
if so, does anyone have an example they might share or code snippets?
greetings
Can you help answer these questions from other members on futures io?
This is possible. You can code an indicator that performs calculations on another adjustable timeframe. There are a few different solutions:
(1) You can simply add a second bar series to your chart and add an indicator to that bar series. If you do not wish to see it, you can set the second bar series to transparent. The inconvenient of this method is that your chart may suffer from non-equidistant bar spacing.
(2) You can code an indicator that loades secondary bars, which are used for calculations. I have coded a lot of these, and most versions are obfuscated, because it is pretty difficult to do and get a good result.
Examples are:
2a) VisualSMA and VisualEMA: They allow you to calculate the SMA and EMA from minute, tick, volume or Range bars irrespective of your main bar series on the chart. The non-equidistant bar spacing is gone, but you pay a price as the method introduces a little lag. Assume a 500 tick bar which closes at 2:35:42 PM (primary bar) and a 5 min bar which is used for calculating indicator values which closes at 2:35:00 PM. In that case the indicator value calculated from the 2:35:00 PM bar can only be displayed 42 seconds later, when the tick bar closes. You indicator now has a lag, which was not the case for solution (1). You cannot have it all, you will either get non-equidistant bar spacing or a lag. For backtesting this can be avoided, if you primary bar series is a 1-tick series. In that case you are in the best of all worlds, but the result - a 1 tick series on your chart - is not exactly visually appealing.
Exported using NT Version 7.0.1000.11
Indicator will only run on NT 7.0.1000.4 or later.
The VisualSMA is a MTF (multi-timeframe) version of the Simple Moving Average. It will plot on any chart and allows to calculate the moving average
- from …
Exported using NT Version 7.0.1000.11
Indicator will only run on NT 7.0.1000.4 or later.
The VisualEMA is a MTF (multi-timeframe) version of the Exponential Moving Average. It will plot on any chart and allows to calculate the moving average
- …
2b) Here is an open code indicator, which I have published, which allows to calculate the exact opening range of a minute based period on a tick, range or volume chart. The indicators works, but I have recently developed a better approach to the problem. Nevertheless, you could have a look at the code, as it is a genuine multi-timeframe indicator.
Exported using NT Version 7.0.1000.26
Indicator will only run on NT 7.0.1000.5 or later
The indicator displays the opening range and the current open of the RTH session. This version is a multi-timeframe (MTF) version of the standard OpeningRange …
3) It is also possible to calculate composite bars. For example, if you have a 5 min bar series, you can easily calculate indicators using an integer multiple of the 5 min bar period. You could produce a 10 min Stochastics, or a 35 min MACD.
The following user says Thank You to Fat Tails for this post:
Shortly after posting i found your thread where you discuss your two indicators. These are really a great help, thanks again for sharing your work here.
I will keep experimenting using your VisualSMA with a period of 1 and the desired period as input for indicators, which should hopefully have the desired effect.
The following user says Thank You to toulouse-lautrec for this post: