Log in to see Cloud of Tags

Wealth-Lab Wiki

Series Is Above

RSS

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.
  • To count the number of consecutive bars that Series1 has been above Series2 use period = 1.
  • For any other period, SeriesIsAbove returns zero until Series1 has been above Series2 for at least period bars. After being above for period bars, SeriesIsAbove returns 1 and increments with each new bar that Series1 is above Series2.

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 ); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.