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(2); bar < Bars.Count; bar++) { bool PivotLow = (Lowbar-1 < Lowbar-2) && (Lowbar-1 < Lowbar); bool PivotHigh = (Highbar-1 > Highbar-2) && (Highbar-1 > Highbar); if (IsLastPositionActive) { Position p = LastPosition; if (bar+1 - p.EntryBar >= 20) ExitAtMarket( bar+1, p, "After 4 weeks" ); } else { if (PivotLow) BuyAtMarket(bar+1); else if (PivotHigh) ShortAtMarket(bar+1); } } } } }