Let’s dive back into the basics of trading indicators, shall we?
While the Exponential Moving Average (EMA) is relatively straightforward, it's important to note that its execution time remains consistent across different versions. Since EMA doesn’t involve complex loops, we still need some efficient code for quick execution. This updated version addresses that nicely.
Tip: We're using the alternative mode of
OnCalculate(). Here's how it looks:int OnCalculate( constint rates_total, // size of price[] array constint prev_calculated, // number of bars handled in the last call constint begin, // index where meaningful data in price[] starts constdouble& price[] // array of values for calculations );
By adopting this approach, we can reduce execution time even further. Although fetching the selected price via a function adds a bit of time, it’s minimal. For flexibility, we’re sticking with the standard mode for now. Sure, a single-color version could speed things up, but where's the fun in that?


Stay tuned for more tips and tricks on mastering your trading strategies!

Comments 0