Below is the copy of the main code:
//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class SuperTrendRSI : Strategy
{
private RSI RSI1;
private NinjaTrader.NinjaScript.Indicators.TradingIndicato rs.SuperTrend SuperTrend1;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"SuperTrend + RSI";
Name = "SuperTrendRSI";
Calculate = Calculate.OnBarClose;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = false;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.WaitUntilFlat;
TimeInForce = TimeInForce.Gtc;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 20;
// Disable this property for performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = true;
Start_Time = DateTime.Parse("08:00", System.Globalization.CultureInfo.InvariantCulture) ;
Stop_Time = DateTime.Parse("16:00", System.Globalization.CultureInfo.InvariantCulture) ;
Order_Quantity = 1;
Profit_Target = 20;
Stop_Loss = 20;
ST_Multiplier = 3;
ST_ATR = 7;
RSI_Period = 14;
RSI_Smooth = 3;
RSI_BuyTrigger = 30;
RSI_SellTrigger = 70;
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
RSI1 = RSI(Close, Convert.ToInt32(RSI_Period), Convert.ToInt32(RSI_Smooth));
SuperTrend1 = SuperTrend(Close, ST_Multiplier, Convert.ToInt32(ST_ATR));
SetProfitTarget(@"", CalculationMode.Ticks, Profit_Target);
SetStopLoss(@"", CalculationMode.Ticks, Stop_Loss, true);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if ((Times[0][0].TimeOfDay >= Start_Time.TimeOfDay)
&& (Times[0][0].TimeOfDay <= Stop_Time.TimeOfDay)
&& (Position.MarketPosition == MarketPosition.Flat)
&& (RSI1.Default[0] < RSI_BuyTrigger)
&& (SuperTrend1.Buy[0] > 0))
{
EnterLong(Convert.ToInt32(Order_Quantity), "");
BackBrushAll = Brushes.Lime;
}
// Set 2
if ((Times[0][0].TimeOfDay >= Start_Time.TimeOfDay)
&& (Times[0][0].TimeOfDay <= Stop_Time.TimeOfDay)
&& (Position.MarketPosition == MarketPosition.Flat)
&& (RSI1.Default[0] > RSI_SellTrigger)
&& (SuperTrend1.Sell[0] > 0))
{
EnterShort(Convert.ToInt32(Order_Quantity), "");
BackBrushAll = Brushes.Red;
}
// Set 3
if ((Times[0][0].TimeOfDay >= Stop_Time.TimeOfDay)
&& (Position.MarketPosition == MarketPosition.Long))
{
ExitLong(Convert.ToInt32(Position.Quantity), "", @"");
}
// Set 4
if ((Times[0][0].TimeOfDay >= Stop_Time.TimeOfDay)
&& (Position.MarketPosition == MarketPosition.Short))
{
ExitShort(Convert.ToInt32(Position.Quantity), "", @"");
}

Comment