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( Close[bar] > High[bar -2] ) SellAtMarket(bar + 1, p, "H2"); else SellAtLimit(bar + 1, p, 1.075 * High[bar - 2], "Target"); } else if( (Close[bar] > sma[bar]) && (rsi[bar-1] > 1) && (rsi[bar] < 2) ) if( BuyAtLimit(bar + 1, 1.025 * Low[bar]) != null ) LastActivePosition.Priority = -roc[bar]; } } } }