public Divergence(DataSeries source, WealthLab.Indicators.MAType maType, int period, string description) public static DivergenceSeries(DataSeries source, WealthLab.Indicators.MAType maType, int period)
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() { /* Buy when Divergence crosses above zero, sell when going below. Educational only! */ DataSeries hist = Divergence.Series( MACD.Series(Close), MAType.EMAModern, 9 ); ChartPane MACDPane = CreatePane( 50, true, true ); PlotSeries( MACDPane, hist, Color.Maroon, LineStyle.Histogram, 2 ); for(int bar = 26 * 3; bar < Bars.Count; bar++) { if( CrossOver( bar, hist, 0 ) ) BuyAtMarket( bar+1 ); if( CrossUnder( bar, hist, 0 ) ) SellAtMarket( bar+1, Position.AllPositions, "MACD" ); } } } }