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() { for(int bar = GetTradingLoopStartBar(1); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (p.EntrySignal.Contains("Group1|")) { if (bar - p.EntryBar >= 2) { SellAtClose(bar, p, "Group1"); } } if (p.EntrySignal.Contains("Group2|")) { if (bar - p.EntryBar >= 2) { CoverAtClose(bar, p, "Group2"); } } } else { BuyAtMarket(bar+1, "Group1|"); ShortAtMarket(bar+1, "Group2|"); } } } } }