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



"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 :)
Attachment download
📎 ema.mq5 (7.46 KB)
Source: MQL5 #25047
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •