//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class Scalping : Strategy
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"I will be using this to go long on failed 2 downs that close green and failed 2ups that close red above or below the 10EMA respectively. ";
Name = "Scalping";
Calculate = Calculate.OnBarClose;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Day;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.ByStrategyPosition;
BarsRequiredToTrade = 1;
// Disable this property for performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = true;
EMAPeriod = 10;
}
else if (State == State.Configure)
{
AddDataSeries("NQ DEC23", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
SetProfitTarget(@"12", CalculationMode.Ticks, 12);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if ((Low[0] < Low[0])
&& (High[0] < High[1])
&& (Close[0] > Open[0])
&& (Times[0][0].TimeOfDay >= new TimeSpan(9, 31, 0))
&& (Times[0][0].TimeOfDay <= new TimeSpan(16, 29, 0))
&& (CurrentBars[0] >= EMAPeriod))
{
EnterLongStopMarket(10, (GetCurrentAsk(0) + (1 * TickSize)) , @"2D green long");
}
// Set 2
if ((High[0] > High[1])
&& (Low[0] > Low[1])
&& (Close[0] < Open[0])
&& (Times[0][0].TimeOfDay >= new TimeSpan(9, 31, 0))
&& (Times[0][0].TimeOfDay <= new TimeSpan(16, 29, 0))
&& (CurrentBars[0] <= EMAPeriod))
{
EnterShortStopMarket(10, (GetCurrentBid(0) + (1 * TickSize)) , @"ShortEntry");
}
}
This is what I have so far. I cannot seem to populate any data when I backtest it.

Comment