using System; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators;namespace WealthLab.Strategies { public class ReversingMACD : WealthScript { protected override void Execute() { DataSeries macd = MACD.Series( Close ); ChartPane MACDPane = CreatePane( 30, true, true ); PlotSeries( MACDPane, macd, Color.Red, LineStyle.Solid, 1 ); DrawHorzLine( MACDPane, 0, Color.Blue, LineStyle.Dashed, 1 ); // Reversing MACD RevEngMACD r = RevEngMACD.Series( Close,12,26 ); PlotSeries( PricePane, r, Color.Blue, LineStyle.Dashed, 2 ); for(int bar = r.FirstValidValue; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( macd[bar] > 0 ) SellAtStop( bar+1, LastPosition, r[bar] ); } else { if( macd[bar] < 0 ) BuyAtStop( bar+1, r[bar] ); } } } } }