An exponential moving average (EMA) basically weights newer prices more than older ones, thereby reducing lag and applying more weight to recent prices (for more details on EMA, visit https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average). This way, more recent price changes have a greater effect on the overall average. Let's build our EMA function. To begin, I'll use raw algebra to outline the equation:
tick-window) for which our EMA will apply. Since our SMA has used 20 time periods (or ticks), we're also going to use this number for our EMA.