EMPlus

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

Syntax

public EMPlus(DataSeries source, int period, string description)
public static EMPlus 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

EM+ is the percentage of bars that have made new highs within the specified period. See EMMinus for additional information.

Interpretation


Calculation

EMPlus is simply the percentage of bars that have achieved new highs within the specified lookback period. Consider, for example, the EMPlus with a period of 40. Within the past 40 bars there have been 20 bars that have reached a 40 bar high. The EMPlus indicator value for this bar would be 50, because 50% of the bars have reached new highs 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() { ChartPane EMPane = CreatePane( 35, true, true ); DataSeries EMPlus1 = EMPlus.Series( Close, 40 ); PlotSeries( EMPane, EMPlus1, Color.Blue, LineStyle.Solid, 1 ); PlotStops(); for(int bar = 40; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if( p.MAEAsOfBarPercent(bar) < -6 ) SellAtMarket( bar+1, p, "Stop Loss 6%" ); else SellAtAutoTrailingStop( bar+1, p, 2, 25, "Trailing Stop 2,25" ); } else { // Looks like a bull trend has formed if( CrossOver( bar, EMPlus1, 20 ) ) BuyAtMarket( bar+1, "Bull" ); } } } } }