This is the code I have setup:
protected override void OnBarUpdate()
{
if (BarsInProgress != 0 || CurrentBars[0] < BarsRequiredToTrade)
{
return; // Wait until there are enough bars
}
if (Position.MarketPosition == MarketPosition.Flat && Close[0] > EMA1[0])
{
EnterLong(Convert.ToInt32(DefaultQuantity), "LongEntry");
SetStopLoss(CalculationMode.Price, Swing(5).SwingLow[0]);
}
}
I have plotted a Swing indicator on my chart with the strength of 5
private EMA EMA1;
private Swing swingLowIndicator;
private Swing swingHighIndicator;
else if (State == State.DataLoaded)
{
EMA1= EMA(Close, 21);
EMA1.Plots[0].Brush = Brushes.Goldenrod;
AddChartIndicator(EMA1);
swingLowIndicator = Swing(5); // Swing indicator with a strength of 5
swingHighIndicator = Swing(5); // Swing indicator with a strength of 5
AddChartIndicator(swingLowIndicator);
AddChartIndicator(swingHighIndicator);
SetProfitTarget("", CalculationMode.Ticks, 90);
}
Can anyone help me out with this setup?

Comment