Documentation/AlgoCode/Function reference
ema
Exponential moving average
Reference/Moving averages/Function
ema(source, length)
Newer bars weigh more, so EMA turns faster than SMA. Short form `ema(9)` uses close.
Parameters
| Name | Type | Description |
|---|---|---|
sourceoptional | series default close | Series to use. Omit it when the first argument is a number — ema(9) means ema(close, 9). |
length | int default 9 | Lookback in bars. Default 9. |
Return value
series
Short form: if the first argument is a number, Dovee uses close as the source.
Example
fastLen = input 9 as "Fast EMA" slowLen = input 21 as "Slow EMA" fast = ema(close, fastLen) slow = ema(close, slowLen) plot fast as "Fast" blue plot slow as "Slow" orange when fast crosses above slow buy when fast crosses below slow exit