I have a strategy where I am looking at the 9:50AM using the 1 MIN bar on NQ.
I ran a backtest and the strategy on Mon 18 March '24 should trigger bullish as shown in the small picture below.
Instead, it triggers short. Help!
I'm using this code to establish direction, then using IF / ELSE IF to enter the next 1 minute bar.
isBarLong = Close[0] > Open[0]);
isBarShort = Close[0] < Open[0]);
if ((Time[0].TimeOfDay).Equals(entryTime))
{
// If the bar is long, go short
Print ("Short" + (entryPrice = Close[0]));
SetStopLoss("ShortPosition", CalculationMode.Ticks, 40, false);
SetProfitTarget("ShortPosition", CalculationMode.Ticks, 60);
Print ("Triggered Short");
// If the bar is short, go long
{
Print ("Long" + (entryPrice = Close[0]));
SetStopLoss("LongPosition", CalculationMode.Ticks, 40, false);
SetProfitTarget("LongPosition", CalculationMode.Ticks, 60);
Print ("Triggered Long");

Comment