a new entry is made. I added a counter so hopefully only the entry variables are set once. I still get the second entry. Is this a real
outcome of the code or is this a problem with granularity of back test? The correct entry is at the top of the Gold candle which is
the first candle to satisfy conditions.
here is pertinent code:
// Set 1
if ((Close[1] < Open[1])
&& (Close[0] > Open[0])
&& (Low[0] < Low[1])
&& (High[0] < High[1])
&& (Close[0] > Close[1])
&& (Close[0] > EMA1[0])
&& (BarCounter1[0] > 60)
&& (BarCounter1[0] < 78)
&& (CounterSet==0))
{
EntryLong = (High[0] + (2 * TickSize)) ;
BarBrush = Brushes.Gold;
CounterSet=1;
// StopLong = (High[0] - (Target * TickSize)) ;
PlaySound(@"C:\Program Files\NinjaTrader 8\sounds\AutoBreakEven.wav");
}
// Set 2
if (EntryLong > 0)
{
EnterLongLimit(Convert.ToInt32(Contracts), EntryLong, @"Long");
}
// Set 3
if (Position.MarketPosition == MarketPosition.Long)
{
EntryLong = 0;
CounterSet = 0;
out come picture:

Comment