Programming the EMa SHIFT in steps of .25 instead of in steps of 1

 

Hi everyone,

this is my first post and im asking experienced programmers if its possible to be able to change the indicator moving average in steps of .25 the EMA SHIFT instead in steps of 1. ?

If my question is not clear , please let me know.

cheers

Serge

 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Serge Tremblay: this is my first post and im asking experienced programmers if its possible to be able to change the indicator moving average in steps of .25 the EMA SHIFT instead in steps of 1. ? If my question is not clear , please let me know.

A shift is in units of bars, so you can't have parcial bars. Instead work on a lower time-frame and adjust the moving average period accordingly.

For example, an EMA(20) on H1 would translate to an EMA(80) on an M15. That way on the M15, each bar shift would be equivalent to a 0.25 shift on the H1.

 

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.


 

Why would you need to do that in code? Like what was said anyway, the answer is no. shift is bar shift

 

Thank you Fernando for your help,  and sorry if my question was not in the good section.

the reason i asked this question  is that im using renko bars and not normal time charts.


So i was thinking if their was a way to redo the programming of the moving average indicator to display on the screen.

 
Serge Tremblay #: the reason i asked this question  is that im using renko bars and not normal time charts. So i was thinking if their was a way to redo the programming of the moving average indicator to display on the screen.

It will not be possible on Renko Bars, because you will not be able to calculate equivalence on a lower time-frame, and currently a shift has to be in whole bar units.

You would have to create your own custom indicator and calculate interpolated values.

However, I don't really see any advantage to using partial shifts.

 
Fernando Carreiro #:

It will not be possible on Renko Bars, because you will not be able to calculate equivalence on a lower time-frame, and the currently a shift has to be in whole bar units.

Ok thank you Fernando

cheers

Serge

Reason: