I found a MTF indicator that is useful to get result on current TF and Bigger TF only, but can not calculate the smaller TF.
This is not really true. You can calculate values for lower timeframes than shown on chart without any problem. You just can’t visualize those numbers in the way we are used to when looking at MT4 indicators.
Most simple case: the same timeframe on chart and on indicator (red volume histogram on my pic). We’re used to display a histogram value right below the bar it belongs to (the same value in the time domain). Thats ok, if we do not calculate specials like Ichimoku, or a delayed signal line.
If we want to calculate our Volume indicator for higher timeframes (blue histo: H1 on a M15 chart) we will usually calculate the indicator value for that higher timeframe and display it under ALL bars that relate to this time period on lower timeframe. In our example: each H1 time interval will show 4 identical volume values, the total tick volume of that H1 bar (let’s leave aside here whether it would make sense to divide this volume by 4).
Now for the other way round: M15 chart, and we want our volume indicator to show M5 values. We can calculate these values easily, but how would we visualize them? Under each bar, we would have to place 3 volume values. This would break the ‘usual’ way of displaying indicators. That’s why you will hardly find such indicators.
So most indicators labeled MTF multi timeframe are indeed HTF high timeframe indicators.
I’ll attach a simple HTF volume, just as an example of how to code such an indicator without utilizing iCustom calls. As you can see when reviewing my code, the
OnCalculate() function is simple and clean, just as it should be. The only difference here as compared to a simple volume on current timeframe is to calculate which bar index on higher timeframe relates to the bar shift on current timeframe:
shiftHTF = getHtfShift(symb, ctf, htf, shift); That’s all.
The rest of HTF calculation is done in
OnInit(). Here we check and set the working timeframe, and we check whether a sufficient number of bars is available on current and higher timeframe. It’s as simple as that.
There are different ways to code HTF indicators, this one is just my personal preference. Would be interested in your solutions and why you would prefer those!
Attachments:You must be logged in to view attached files.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)