EMMinus

Modified on 2008/04/17 13:05 by Administrator — Categorized as: Standard Indicators

Syntax

public EMMinus(DataSeries source, int period, string description)
public static EMMinus Series(DataSeries source, int period)
public static double Value(int bar, DataSeries source, int period)

Parameter Description

source Price series
period Indicator calculation period

Description

Markets that are experiencing rising trends frequently make new highs, and those in falling trends new lows. The Extreme Motion Index is a way of measuring a market's trend strength by counting the frequency of new highs and lows in a given period. EM- is the percentage of bars that have made new lows within the specified Period.

Interpretation


Calculation

EMMinus is simply the percentage of bars that have achieved new lows within the specified lookback period. Consider, for example, the EMMinus with a period of 40. Within the past 40 bars there have been 10 bars that have reached a 40 bar low. The EMMinus indicator value for this bar would be 25, because 25% of the bars have reached new lows in the period.

Example

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { /* Enter short when EMMinus turns up and start a trailing stop when it crosses 19 */ bool TStopOn = false; ChartPane EMPane = CreatePane( 35, true, true ); DataSeries emm = EMMinus.Series( Close, 40 ); PlotSeries( EMPane, emm, Color.Red, WealthLab.LineStyle.Solid, 1 ); PlotStops();

for(int bar = emm.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if( CrossOver( bar, emm, 19 ) ) TStopOn = true;

if( p.MAEAsOfBarPercent( bar-1 ) < -8 ) CoverAtStop( bar, p, p.EntryPrice*1.08, "Stop Loss @ 8%" ); else if( p.MFEAsOfBarPercent( bar-1 ) > 5 ) CoverAtStop( bar, p, p.EntryPrice, "Breakeven @ 5%" ); if( TStopOn == true ) CoverAtTrailingStop( bar+0, p, High[bar-3]+0.1, "Trailing Stop" ); } else { // Looks like a bear trend has formed if( ( emm[bar-1] < 0.01 ) & TurnUp( bar, emm ) ) { if( ShortAtMarket( bar+1, "Bear" ) != null ) TStopOn = false; } } } } } }