Signals Help Center
  • About Signals
  • Getting Started
    • Tutorials
      • Your First Strategy
        • Create a New Strategy
        • Define Variables
        • Define Setup Method
        • Define Register Actions Method
        • Backtest
        • Deploy Strategy & Start Receiving Signals
    • Dashboard
    • Strategies
      • Strategy Tools and Settings
        • Editor
        • Strategy Detail
        • Backtests
          • Backtest Detail
          • Deploying a Backtest
          • Delete a Backtest
        • Deployments
          • Deployment Detail
          • Edit About, Rules & Alternative Markets
          • Undeploy an Active Deployment
          • (Un)Publish a Deployment
          • (Un)Follow a Deployment
          • Delete a Deployment
        • Followings
          • Following Detail
          • Unfollow a Deployment
          • Delete Record of Following
      • Strategies Marketplace
        • Follow a Strategy
        • Publish Strategy
      • Strategy Details
      • Strategy Metrics
        • Initial Capital
        • Initial Capital (USDT)
        • Strategy Balance
        • Strategy Balance (USDT)
        • Total Performance
        • Total Performance (USDT)
      • Strategy Types
        • Single Market Strategy
        • Multi Market Strategy
    • Account
      • Change Plan
      • Change or Reset Password
      • Change Name, Username, or E-mail
  • Framework Documentation
    • Strategy
      • Methods
        • Setup()
          • DataMarketplace
          • IndicatorsMarketplace
        • RegisterActions()
        • Orders Management
          • CancelOrder()
          • CancelAllPendingOrders()
          • EnterLong()
          • EnterLongLimit()
          • EnterShort()
          • EnterLongStop()
          • EnterShortLimit()
          • ExitLong()
          • EnterShortStop()
          • ExitLongLimit()
          • ExitShort()
          • ExitShortLimit()
          • ExitLongStop()
          • ExitShortStop()
        • Risk Management
          • SetProfitTarget()
          • SetStopLoss()
      • Properties
        • Market
        • Markets
        • PendingOrders
        • Position
        • Time
      • Types
        • IOrder
        • PendingOrder
    • Data
    • Logs
  • Knowledge Base
    • Vocabulary
      • Base currency
      • Deployment
      • Following
      • Quote currency
      • Strategy
    • Technical Indicators
      • Oscillators
        • Average Directional Index (ADX)
        • Momentum Indicator (MOM)
        • Moving Average Convergence Divergence (MACD)
        • Relative Strength Index (RSI)
        • Stochastic RSI (STOCH RSI)
      • Volatility
        • Average True Range (ATR)
        • Bollinger Bands (BB)
      • Trend Analysis
        • Exponential Moving Average (EMA)
        • Simple Moving Average (SMA)
        • Volume-weighted Moving Average (VWMA)
        • Weighted Moving Average (WMA)
      • Volume
        • Accumulation/Distribution Line (ADL)
  • Have a question?
    • FAQ
    • Ask on the forums
    • Contact us
Powered by GitBook
On this page
  • Trading application
  • Calculation
  • Parameters
  • Examples
  1. Knowledge Base
  2. Technical Indicators
  3. Trend Analysis

Exponential Moving Average (EMA)

Moving average indicator which measures the trend direction over a period of time.

Exponential Moving Average (EMA) is a moving average indicator which measures the trend direction over a period of time. It places more importance on recent price data than other moving averages like SMA. Unlike other Moving Averages, EMA uses a multiplier which takes into account older data, even if they are outside of the period of days selected.

Trading application

EMA is a line which is shown within the price graph, moving close to the price and eventually intersecting with it. EMA moving above the price indicates a downtrend while EMA moving below the price indicates an uptrend. It can also act as a level of Support/Resistance in uptrends and downtrends, respectively.

We can interpret buy/sell signals by using 2 different EMA lines (one assessing a shorter period than the other). If the shorter EMA (e.g. a 20 day EMA) crosses upwards over the longer SMA (e.g. 50 days), it is a buy signal. The opposite, where the shorter EMA crosses downwards under the longer EMA, indicates a sell signal. Another interpretation arises when intersecting with the price. A shorter EMA crossing the price from the bottom up, while remaining above the longer EMA, is considered a buy signal in the same way that the shorter EMA crossing the price from above downwards, while the longer EMA is located above the shorter EMA, indicates a sell signal.

Calculation

[Price−EMA(PreviousDay)]∗Multiplier+EMA(PreviousDay)[Price - EMA(PreviousDay)] * Multiplier + EMA (PreviousDay)[Price−EMA(PreviousDay)]∗Multiplier+EMA(PreviousDay)

For the first EMA(Previous day) we use SMA. SMA = sum of X days closing prices / X Multiplier = 2 / (Time periods used + 1 )

Parameters

Input Parameters

Name

Type

Range of value

Description

emaLength

int

<1, int.MaxValue>

Number of bars used in the calculation.

Output Parameters

Indicator ouptuts a single value.

Type

Range of value

double

(0, double.MaxValue)

Examples

// Prints the current value of a 20 period EMA using
// the daily bars close price value.
ema = indicators.EMA(20).OnSeries(dailyBars.Close);
Log("The current EMA value is " + ema.Value.ToString());

// Prints the previour EMA value
ema = indicators.EMA(20).Keep(2).OnSeries(dailyBars.Close);
Log("The previous EMA value is " + ema.Values[1].ToString());

Complete example

using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.EMA;

public class MyStrategy : SingleMarketStrategy
{
    private Bars dailyBars;
    private EMA ema;

    public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
    {
        dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(25);
        ema = indicators.EMA(20).Keep(2).OnSeries(dailyBars.Close);
    }

    public override void RegisterActions()
    {
        OnUpdateOf(dailyBars).Do(() =>
        {   
            // Prints the current EMA value
            Log("The current EMA value is " + ema.Value.ToString());

            // Prints the previour EMA value
            Log("The previous EMA value is " + ema.Values[1].ToString());
        });
    }
}

PreviousTrend AnalysisNextSimple Moving Average (SMA)

Last updated 5 years ago