Series Is Above

Modified on 2016/07/14 11:11 by Eugene — Categorized as: Community Indicators

SeriesIsAbove: Indicator Documentation

Syntax


SeriesIsAbove(DataSeries ds1, DataSeries ds2, int period)
SeriesIsAbove(DataSeries ds1, DataSeries ds2, int period, string description)

Parameter Description

ds1First data series
ds2Second data series
periodPeriod for which the 1st data series should be above the 2nd data series

Description

Returns the number of consecutive bars that Series1 has been above Series2 minus the Period bars.
See Series Is Below.

Example

This example illustrates the indicator's application by plotting a histogram output for the number of consecutive bars that the 20-period SMA is above/below the 50-period SMA:


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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { HideVolume(); SMA ds1 = SMA.Series( Close, 20 ); SMA ds2 = SMA.Series( Close, 50 ); PlotSeries( PricePane, ds1, Color.Blue, LineStyle.Solid, 1 ); PlotSeries( PricePane, ds2, Color.Red, LineStyle.Solid, 1 ); SeriesIsAbove sa = SeriesIsAbove.Series( ds1, ds2, 1); SeriesIsBelow sb = SeriesIsBelow.Series( ds1, ds2, 1); ChartPane psa = CreatePane( 30, true, true ); ChartPane psb = CreatePane( 30, false, true ); PlotSeries( psa, sa, Color.Blue, LineStyle.Histogram, 2 ); PlotSeries( psb, sb, Color.Red, LineStyle.Histogram, 2 ); } } }