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() { DataSeries rsi = RSI.Series(High, 2); DataSeries sma = SMA.Series(Close, 200); DataSeries roc = ROC.Series(Close, 5); ChartPane rsiPane = CreatePane(40, true, true); PlotSeries(PricePane, sma, Color.Blue, LineStyle.Solid, 1); PlotSeries(rsiPane, rsi, Color.Green, LineStyle.Solid, 2); for(int bar = Bars.FirstActualBar + 200; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if( bar + 1 - p.EntryBar >= 6 ) SellAtMarket(bar + 1, p, "Time-based"); else if( Closebar > Highbar -2 ) SellAtMarket(bar + 1, p, "H2"); else SellAtLimit(bar + 1, p, 1.075 * Highbar - 2, "Target"); } else if( (Closebar > smabar) && (rsibar-1 > 1) && (rsibar < 2) ) if( BuyAtLimit(bar + 1, 1.025 * Lowbar) != null ) LastActivePosition.Priority = -rocbar; } } } }