So I made a simple strategy with the following INTENT (which isn't working for some reason): If the Swing indicator has a current low higher than last low, buy when price crosses above current SwingHigh.
Here is the relevant code:
// Set 1
if ((Position.MarketPosition == MarketPosition.Flat)
&& (BarsSinceExitExecution(0, "", 0) != 0)
&& (Swing(2).SwingLowBar(0, 1, 50) >= Swing(2).SwingLowBar(0, 2, 50))
&& (CrossAbove(Close, Swing1.SwingHigh, 1)))
{
EnterLong(1, @"LongEntry");
}
// Set 2
if ((Position.MarketPosition == MarketPosition.Flat)
&& (BarsSinceExitExecution(0, "", 0) != 0)
&& (Swing(2).SwingHighBar(0, 1, 50) <= Swing(2).SwingHighBar(0, 2, 50))
&& (CrossBelow(Close, Swing1.SwingLow, 1)))
{
EnterShort(1, @"ShortEntry");
}
It doesn't seem to be working, it just shorted under a current high > than previous high AND current low > previous low and no SwingLow was present for it to cross. Any ideas?
In the picture, it shorted at 19111.50 at 11:23:19 AM on the red falling hammer bar that passed below the green bar over the crosshairs (i.e. second red bar right of the last green bar).


Comment