public OBV(Bars bars, string description) public static OBV Series(Bars bars)
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() { // This simple systems buys and sells based on a moving average crossover of OBV WealthLab.Indicators.EMACalculation m = WealthLab.Indicators.EMACalculation.Modern; DataSeries obv = OBV.Series( Bars ); DataSeries OBV1 = EMA.Series( obv, 24, m ); DataSeries OBV2 = EMA.Series( obv, 48, m ); for(int bar = 48*3; bar < Bars.Count; bar++) { if( CrossOver( bar, OBV1, OBV2 ) ) BuyAtMarket( bar+1 ); else if( CrossUnder( bar, OBV1, OBV2 ) ) SellAtMarket( bar+1, Position.AllPositions, "OBV" ); } ChartPane OBVPane = CreatePane( 40, false, true ); PlotSeries( OBVPane, obv, Color.Brown, WealthLab.LineStyle.Solid, 2 ); PlotSeries( OBVPane, OBV1, Color.Black, WealthLab.LineStyle.Dotted, 2 ); PlotSeries( OBVPane, OBV2, Color.Red, WealthLab.LineStyle.Dotted, 2 ); } } }