I've been trying to implement the Most Recent Occurrence function in my strategy as documented here;
In this simple example I'm trying to draw a line between two swing highs;
protected override void OnBarUpdate() { if (BarsInProgress != 0) return; if (CurrentBars[0] < 1) return; int first_high_barsAgo = MRO(() => Swing(Close, 3).SwingHigh[0] != Swing(Close, 3).SwingHigh[1], 1, 99); int second_high_barsAgo = MRO(() => Swing(Close, 3).SwingHigh[0] != Swing(Close, 3).SwingHigh[1], 2, 99); if (first_high_barsAgo > -1 && second_high_barsAgo > -1) Draw.Line(this, @"v3 Line_1"+CurrentBar, false, second_high_barsAgo, High[second_high_barsAgo], first_high_barsAgo, High[first_high_barsAgo], Brushes.Plum, DashStyleHelper.Solid, 2); }
Thanks
MT
Comment