Log in to see Cloud of Tags

Wealth-Lab Wiki

CrossOverBar

RSS

CrossOverBar: Indicator Documentation

Syntax

DataSeries CrossOverBar( DataSeries ds1, DataSeries ds2 );

Parameter Description

ds1 First data series
ds2 Second data series

Description

CrossOverBar(DataSeries1, DataSeries2) returns the most recent bar where DataSeries1 crossed over DataSeries2. No check is made about a possible subsequent CrossUnder.

Example

This example illustrates how to plot and call the CrossOverBar series. The entry is made when Close has crossed over the Lower Bollinger Band within last 3 bars, and it is still currently over the same band:


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 XOBStrategy : WealthScript { protected override void Execute() { BBandLower bbL = BBandLower.Series( Close, 20, 2 ); CrossOverBar xob = CrossOverBar.Series( Close, bbL ); SetBarColors( Color.Silver, Color.Silver ); for (int bar = xob.FirstValidValue; bar < Bars.Count; bar++) { if( xob[bar] == bar ) SetBarColor( bar, Color.Red ); if (IsLastPositionActive) { CoverAtStop( bar+1, LastPosition, Highest.Series( High, 20 )[bar] ); } else { if( ( Close[bar] < bbL[bar] ) & ( xob[bar] > bar - 3 ) ) ShortAtMarket( bar+1 ); } } ChartPane xPane = CreatePane( 20, true, true ); PlotSeries( xPane, xob, Color.Red, WealthLab.LineStyle.Dashed, 2 ); PlotSeries( PricePane, bbL, Color.Red, WealthLab.LineStyle.Solid, 1 ); } } }

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.