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( macdbar > 0 ) SellAtStop( bar+1, LastPosition, rbar ); } else { if( macdbar < 0 ) BuyAtStop( bar+1, rbar ); } } } } }