Technical indicators Ease of Movement (EMV)


Background

Ease of movement (EMV) is a technical analysis indicator that is related to an asset’s price change to its volume. High positive values indicate the price is increasing on low volume, strong negative values indicate the price is dropping on low volume. The moving average of the indicator can be added to act as a trigger line, which is similar to other indicators like MACD.

Theoretically, if prices move easily, they will continue to do so for a period of time that can be traded effectively. The EMV indicator fluctuates around a zero-line. When the indicator is above the line, in positive territory, prices are advancing with relative ease - the greater the value the greater the “ease”. Similarly, when the indicator is negative, prices are decling with relative ease depending on how negative.

Python Implementation

import pandas as pd
import sqlite3

# load S&P500 data from stored database
sp500_db = sqlite3.connect(database="sp500_data.sqlite")

df = pd.read_sql_query(sql="SELECT * FROM SP500",
                       con=sp500_db,
                       parse_dates={"Date"})
df.head()

indexDateTickerlevel_0Adj CloseCloseHighLowOpenVolume...atrmacdmacd signalbb_lowbb_midbb_highsmaemaadobv
002014-04-29A035.04953438.12589338.30472237.17453438.1187404688612.0...NaNNaNNaNNaNNaNNaNNaNNaN3.204858e+064688612.0
112014-04-29AAL133.47674235.50999835.65000234.97000135.2000018994200.0...NaNNaNNaNNaNNaNNaNNaNNaN5.290623e+068994200.0
222014-04-29AAPL218.63333321.15464221.28500021.05392821.205000337377600.0...NaNNaNNaNNaNNaNNaNNaNNaN-4.328196e+07337377600.0
332014-04-29ABBV334.03498551.36999951.52999950.75999850.9399995601300.0...NaNNaNNaNNaNNaNNaNNaNNaN3.273491e+065601300.0
442014-04-29ABT431.83151838.54000138.72000138.25999838.3699994415600.0...NaNNaNNaNNaNNaNNaNNaNNaN9.599290e+054415600.0

5 rows × 22 columns

# remove irrelevant columns
df = df.drop('index', axis=1)
#df = df.drop('level_0', axis=1)
df.head()

DateTickerlevel_0Adj CloseCloseHighLowOpenVolumegarmin_klass_vol...atrmacdmacd signalbb_lowbb_midbb_highsmaemaadobv
02014-04-29A035.04953438.12589338.30472237.17453438.1187404688612.0-0.002274...NaNNaNNaNNaNNaNNaNNaNNaN3.204858e+064688612.0
12014-04-29AAL133.47674235.50999835.65000234.97000135.2000018994200.0-0.000788...NaNNaNNaNNaNNaNNaNNaNNaN5.290623e+068994200.0
22014-04-29AAPL218.63333321.15464221.28500021.05392821.205000337377600.0-0.006397...NaNNaNNaNNaNNaNNaNNaNNaN-4.328196e+07337377600.0
32014-04-29ABBV334.03498551.36999951.52999950.75999850.9399995601300.0-0.062705...NaNNaNNaNNaNNaNNaNNaNNaN3.273491e+065601300.0
42014-04-29ABT431.83151838.54000138.72000138.25999838.3699994415600.0-0.013411...NaNNaNNaNNaNNaNNaNNaNNaN9.599290e+054415600.0

5 rows × 21 columns

import pandas_ta

df = df.set_index(['Date','Ticker'])

# compute EMV

def compute_emv(stock_data):
    emv = pandas_ta.eom(high=stock_data['High'],
                        low=stock_data['Low'],
                        close=stock_data['Close'],
                        volume=stock_data['Volume'],
                        length=14)
    return emv

df['emv'] = df.groupby(level=1, group_keys=False).apply(compute_emv)
df.tail()

level_0Adj CloseCloseHighLowOpenVolumegarmin_klass_volrsiatrmacdmacd signalbb_lowbb_midbb_highsmaemaadobvemv
DateTicker
2024-04-25XYL1232347130.610001130.610001131.199997128.100006129.619995963600.00.00026461.4827450.6653060.3551460.2552764.8455914.8635024.881413128.482000128.5826951.381747e+0842359600.0-1.275613
YUM1232348141.559998141.559998142.169998140.389999141.9799961693100.00.00007665.6681630.3225660.5508300.2857844.9134824.9379684.962454138.497000138.6585638.902989e+07253995207.047.014878
ZBH1232349119.750000119.750000121.349998118.769997120.7099991078800.00.00020635.636078-0.350196-0.889200-0.6464804.7728464.8358884.898931125.012999123.5655697.870077e+07-62096220.0-114.852947
ZBRA1232350292.529999292.529999293.290009271.630005274.359985674700.00.00135556.1722720.500501-0.391439-0.2424565.5887305.6663875.744044288.205502284.2623625.349014e+0737474700.0-2359.322092
ZTS1232351153.360001153.360001153.589996150.039993150.9700014567200.00.00017839.8096191.374957-3.202379-3.5843534.9674085.0650655.162723157.579352157.0035212.636284e+08255609600.0-95.499616
# update the database
df = df.reset_index()
df.to_sql(name="SP500",
          con=sp500_db,
          if_exists="replace",
          index=True)
sp500_db.close()
import matplotlib.pyplot as plt
from datetime import datetime

# select AAPL
aapl = df[df['Ticker'] == 'AAPL'].set_index('Date')

# only select the data from 2022-01-01
aapl_new = aapl[aapl.index > datetime(2022,1,1)]

# set the theme of the chart
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (20,16)

# create two charts on the same figure
ax1 = plt.subplot2grid((10,1),(0,0), rowspan=4, colspan=1)
ax2 = plt.subplot2grid((10,1),(5,0), rowspan=4, colspan=1)

# plot the closing price on the first chart
ax1.plot(aapl_new['Adj Close'])
ax1.set_title('AAPL Adjust Close Price')

# plot the EMV on the second chart
ax2.plot(aapl_new['emv'], color='orange', linewidth=1)
ax2.set_title('AAPL Ease of Movement')
Text(0.5, 1.0, 'AAPL Ease of Movement')

AAPL Ease of Movement

Reference

Ease of Movement Indicator: Overview, Formula, FAQ by Gordon Scott on Investopedia


Author: wenvenn
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source wenvenn !