Multi Time Frame Moving Average and how to make it work on 1 min chart

 

Hello.

In MT4 I had a MTF MA indicator and it is working nice.

The problem is that I can't find any sample in MT5 which works the similar.

Simply, I want to use 1 min chart  and I want to attach to that chart SMA calculated on 15 min chart.

I can't solve that.

Any help will be very useful.

Thanks.

 
Dragisa Vasiljevic: The problem is that I can't find any sample in MT5 which works the similar.

Really? I don't think you tried very hard. Click on the search, enter MTF, click code base. On just the second page were two MT5 indicators. Search - MQL5 community

 

Hi William,

Yes, I tried and I didn't find any trustworthy.

Did You try to compare graphs on MT5 and MT4 charts with the same input parameters, eg. on 1 min chart plot SMA with MA Period 13, calculating with data from 15 min chart?

I didn't find they are the same, opposite, they are totally different.

Please, if You know what is the indicator link, it would be very kind of You and I will be very grateful. 

Regards, and thanks in advance.

 
Your topic has been moved to the section: Technical Indicators — In the future, please consider which section is most appropriate for your query.
 
Dragisa Vasiljevic #: Did You try to compare graphs on MT5 and MT4 charts with the same input parameters, eg. on 1 min chart plot SMA with MA Period 13, calculating with data from 15 min chart? I didn't find they are the same, opposite, they are totally different. Please, if You know what is the indicator link, it would be very kind of You and I will be very grateful. 

Have you considered using "equivalence" instead of MTF?

Forum on trading, automated trading systems and testing trading strategies

Time Frames Moving Averages

Fernando Carreiro, 2022.11.15 11:43

Are you asking about representing the same equivalent moving average on a different time-frame?

If yes, then a MA(6) on an M10 time-frame would be equivalent to a M(8.57) on a M7 time-frame.

Forum on trading, automated trading systems and testing trading strategies

Daily TF SMA 50 and SMA 200 Values for 15Min?

Fernando Carreiro, 2016.08.22 11:23

Simple Maths!

  • D1 (day) = 24 hours = 1440 minutes.
  • M15 = 15 minutes.
  • D1/M15 = 1440/15 = 96

So to have the equivalent SMA 50 and SMA 200 on the M15 chart, you would have to use an SMA 4800 (50 x 96), and an SMA 19200 (200 x 96).

However, such BIG SMAs, will probably not be very practical and also be more CPU intensive. An alternative is to use a MTF (Multi-timeframe) Moving Average Indicator which will display the Daily SMA on the M15 chart instead. It will not be as smooth as this equivalent, but it will be the EXACT values of the daily one along the entire day.

Try both methods and see which one you prefer.

Forum on trading, automated trading systems and testing trading strategies

SOME EA's working fine on MT4 but NOT when migrated to VPS - They have Indicators with custom timeframes

Fernando Carreiro, 2022.10.07 15:08

Your don't need to generate Offline Charts for such a simple indicator as a moving average and that applies to many indicators. Just adjust the period accordingly.

Example: A SMA(20) on H2 translates to a SMA(40) on H1. It will obviously be slightly different because H1 has more resolution than H2, but will be equivalent.


 

Thank You all to these answers.

Yes I understand the logic behind, but still I'm confused, why in MT5 we need to change the logic which was accepted from all of us in MT4.

Once again Thanks very much.

 
Dragisa Vasiljevic #: Yes I understand the logic behind, but still I'm confused, why in MT5 we need to change the logic which was accepted from all of us in MT4.

There is no change in "logic" between MT4 and MT5 regarding indicators.

There is however a change in how the code for custom indicators is implemented, but the final visual results should be the same if the Indicators are properly coded.

In the CodeBase there are several MTF Moving Average indicators, for example ... Averages MTF V2

So exactly, what is it that is different to your MT4 version?

You did not explain that, nor did you show the differences. So how can we help if you don't explain them?

 

Hi Fernando, I'm glad You are participating in this thread because I really appreciate Your work and answers. 

This is the MT4 Indicator I am using: 

Files:
 

When I attach it with following parameters I have a plot like this:


 

When I try attach the Indicator You show me ( Averages MTF V2) on MT5 platform with input parameters above there is no any MA. It only works with current timeframe. 

What is the reason, and what I did wrong.

Averages MTF V2
Averages MTF V2
  • www.mql5.com
Averages indicator, which contains 18 types of averages available.
 
Dragisa Vasiljevic #: When I attach it with following parameters I have a plot like this:
Is "cMTF_MovingAverage" from the CodeBase? I could not find it.


Dragisa Vasiljevic #: When I try attach the Indicator You show me ( Averages MTF V2) on MT5 platform with input parameters above there is no any MA. It only works with current timeframe. What is the reason, and what I did wrong.

You are correct. There is a bug in the code.

Forum on trading, automated trading systems and testing trading strategies

Indicators: Averages MTF

Fernando Carreiro, 2023.06.23 17:39

There is a bug in the current version, so I changed line 165 as such ...

         if (bars<2 || times[0]>Time[0]) return(prev_calculated);
There may be other bugs but this one was the first I spotted due to the errors in the Experts log.
2023.06.23 16:25:16.247 averages_-_mtf_2 (EURUSD,M1)    array out of range in 'averages_-_mtf_2.mq5' (165,20)
2023.06.23 16:30:00.355 averages_-_mtf_2 (EURUSD,M1)    array out of range in 'averages_-_mtf_2.mq5' (169,53)

I have attached the modified file.

Files: