Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Exponential Moving Average - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources

author EAcpu | 2 reads | 0 comments |

Exponential moving average - indicator for MetaTrader 5

Exponential moving average - indicator for MetaTrader 5

Exponential moving average - indicator for MetaTrader 5

"Back to basics" again:

Although EMA is fairly simple, and code execution times shouldn't vary much from one version to the next (EMA has no loops within loops), we still seem to be lacking some code that is easily reusable and executes quickly. This version fills in a bit

PS: Use an alternative mode to OnCalculate() - this mode:

 When calculating integers ( 
constant integer rate_total, // price[] array size constant integer previously calculated, // number of bars processed at last call constant integer start, // index number of meaningful data in price[] array double from constant & price[] // array of values ​​used for calculation );

will make the execution time shorter and faster (getting the selected price via the function does take some time - not too much, but noticeable compared to the version that doesn't require this), but, for flexibility, uses the "standard" mode. Also, making it a monochrome version would make it faster, but where would the fun be in that :)

Exponential moving average - indicator for MetaTrader 5

Exponential moving average - indicator for MetaTrader 5


Attachment download

📎 ema.mq5 (7.46 KB)

Source: MQL5 #25047

Verification code Refresh