NB this isn't a system, I just reduced it to a trivial example to figure it out.
protected override void Initialize() { Add(Swing(Lookback)); Add(Swing(Lookback)); CalculateOnBarClose = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (CrossAbove(Close, Swing(Lookback).SwingHigh, 1) && Position.MarketPosition != MarketPosition.Long) { EnterLong(DefaultQuantity, ""); ExitLongStop(Swing(Lookback).SwingHigh[0], "", ""); } // Condition set 2 if (CrossBelow(Close, Swing(Lookback).SwingLow, 1)) { ExitLong("", ""); } }
Comment