I need to you optimize this code So i can use it for walk on optimization because i cant currently enter parameters . The NT version is 8.1.4

using System;
using System.ComponentModel.DataAnnotations;
using NinjaTrader.Cbi;
using NinjaTrader.Gui.Tools;
using NinjaTrader.NinjaScript;
using NinjaTrader.NinjaScript.Strategies;
using NinjaTrader.NinjaScript.Indicators;

/// <summary>
/// Professional Opening Range Breakout (ORB) strategy for intraday futures.
/// Uses EMA/RSI/Volume filters, dynamic ATR-based sizing, multi-stage exits (partial, B/E, trailer),
/// and a LiveOnly toggle for safe deployment.
/// </summary>
namespace NinjaTrader.NinjaScript.Strategies
{
    public class ProORB_Strategy_NoDraw : Strategy
    {
        #region Parameters

        /// <summary>Simulated account size for position sizing.</summary>
        [Range(1, double.MaxValue)]
        [Display(Name="Account Size", Description="Dollar value for risk calculations.", GroupName="Parameters", Order=0)]
        public double AccountSize { get; set; } = 100000;

        /// <summary>Risk per trade as % of AccountSize.</summary>
        [Range(0.01, 100)]
        [Display(Name="Risk Percent", Description="Percent of account risked per trade.", GroupName="Parameters", Order=1)]
        public double RiskPercent { get; set; } = 0.5;

        /// <summary>Bars to define the Opening Range.</summary>
        [Range(1, 100)]
        [Display(Name="Opening Range Bars", Description="First N bars for ORB calculation.", GroupName="Parameters", Order=2)]
        public int OpeningRangeBars { get; set; } = 15;

        /// <summary>ATR multiple for initial stop-loss distance.</summary>
        [Range(0.01, 10)]
        [Display(Name="ATR Stop Multiplier", Description="ATR multiple for stop-loss distance.", GroupName="Parameters", Order=3)]
        public double AtrMultiplier { get; set; } = 1.5;

        /// <summary>ATR multiple for initial profit target.</summary>
        [Range(0.01, 10)]
        [Display(Name="ATR Target Multiplier", Description="ATR multiple for profit target distance.", GroupName="Parameters", Order=4)]
        public double PT_AtrMultiplier { get; set; } = 2.5;

        /// <summary>ATR multiple for partial take-profit.</summary>
        [Range(0.01, 10)]
        [Display(Name="ATR Partial TP Multiplier", Description="ATR multiple for partial profit-taking target.", GroupName="Parameters", Order=5)]
        public double PartialTargetMult { get; set; } = 1.0;

        /// <summary>ATR move needed to trigger B/E move before partial exit.</summary>
        [Range(0.01, 10)]
        [Display(Name="ATR BE Trigger Multiplier", Description="ATR move trigger to set stop to B/E prior to partial exit.", GroupName="Parameters", Order=6)]
        public double AtrMultiplierBETrigger { get; set; } = 1.0;

        /// <summary>ATR offset when moving stop to break even.</summary>
        [Range(-1, 2)]
        [Display(Name="ATR BE Offset", Description="Offset added to entry when moving stop to break-even (ATR multiples, can be negative).", GroupName="Parameters", Order=7)]
        public double AtrMultiplierBEOffset { get; set; } = 0.0;

        /// <summary>ATR period for volatility measurement.</summary>
        [Range(1, 100)]
        [Display(Name="ATR Period", Description="ATR lookback period.", GroupName="Parameters", Order=8)]
        public int ATRPeriod { get; set; } = 14;

        /// <summary>EMA period for trend filter.</summary>
        [Range(1, 200)]
        [Display(Name="EMA Period", Description="Period for EMA trend filter.", GroupName="Parameters", Order=9)]
        public int EMAPeriod { get; set; } = 50;

        /// <summary>RSI period for momentum filter.</summary>
        [Range(1, 50)]
        [Display(Name="RSI Period", Description="Lookback for RSI momentum filter.", GroupName="Parameters", Order=10)]
        public int RSIPeriod { get; set; } = 8;

        /// <summary>RSI threshold for momentum filter (long if above, short if below 100-threshold).</summary>
        [Range(1, 100)]
        [Display(Name="RSI Momentum Threshold", Description="Longs require RSI > X; Shorts require RSI < (100-X).", GroupName="Parameters", Order=11)]
        public double RSIMomentumThresh { get; set; } = 55;

        /// <summary>Volume SMA period for liquidity filter.</summary>
        [Range(1, 100)]
        [Display(Name="Volume SMA Period", Description="Lookback for volume liquidity filter.", GroupName="Parameters", Order=12)]
        public int VolumeSMAPeriod { get; set; } = 20;

        /// <summary>Trading session start time (format: 93500 = 09:35:00).</summary>
        [Range(0, 235959)]
        [Display(Name="Trade Window Start", Description="Start time for trade entries (HHMMSS).", GroupName="Parameters", Order=13)]
        public int TradeStartHHMMSS { get; set; } = 93500;

        /// <summary>Trading session end time (format: 111500 = 11:15:00).</summary>
        [Range(0, 235959)]
        [Display(Name="Trade Window End", Description="End time for trade entries (HHMMSS).", GroupName="Parameters", Order=14)]
        public int TradeEndHHMMSS { get; set; } = 111500;

        /// <summary>Lookback period for trailing stop.</summary>
        [Range(1, 100)]
        [Display(Name="Trailing Lookback", Description="Bars for trailing stop lookback window.", GroupName="Parameters", Order=15)]
        public int TrailLookback { get; set; } = 5;

        /// <summary>ATR buffer for trailing stop (distance outside swing point).</summary>
        [Range(0.01, 5)]
        [Display(Name="Trailing ATR Buffer", Description="ATR-multiplied buffer for trailing stop.", GroupName="Parameters", Order=16)]
        public double TrailBufferATRMult { get; set; } = 0.1;

        /// <summary>
        /// If true, only trades on live real-time bars. Set false for backtesting/optimization.
        /// </summary>
        [Display(Name = "Live Trading Only", Description = "If true, disables trading on historical bars for live safety. Set false for backtesting.", GroupName = "Parameters", Order = 100)]
        public bool LiveOnly { get; set; } = false;

        #endregion

        #region Internal Variables

        // ORB state/levels
        private double orbHigh = double.MinValue;
        private double orbLow = double.MaxValue;
        private double entryPrice = 0.0, stopPrice = 0.0, targetPrice = 0.0, partialTarget = 0.0;
        private int tradeDir = 0;
        private bool beMoved = false, partialTaken = false, trailingActive = false;
        // Indicators
        private ATR atr;
        private EMA trendEma;
        private RSI rsi;
        private SMA volSma;

        #endregion

        /// <summary>
        /// One-time setup for indicators and defaults.
        /// </summary>
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Name = "ProORB_Strategy_NoDraw";
                Calculate = Calculate.OnBarClose; // Good for ORB: avoids intra-bar repaint
                IsOverlay = false; // No chart drawing
            }
            else if (State == State.DataLoaded)
            {
                atr = ATR(ATRPeriod);
                trendEma = EMA(EMAPeriod);
                rsi = RSI(RSIPeriod, 3);
                volSma = SMA(Volume, VolumeSMAPeriod);
            }
        }

        /// <summary>
        /// Main strategy logic. Entry, risk, exits.
        /// </summary>
        protected override void OnBarUpdate()
        {
            // Robust Option: Only process on live bars if LiveOnly is true (for safety in production)
            if (LiveOnly && State != State.Realtime)
                return;

            int now = ToTime(Time[0]);
            if (now < TradeStartHHMMSS || now > TradeEndHHMMSS)
                return;

            // Ensure all indicators are ready
            if (CurrentBar < Math.Max(OpeningRangeBars, Math.Max(ATRPeriod, Math.Max(EMAPeriod, Math.Max(VolumeSMAPeriod, RSIPeriod)))))
                return;
            if (BarsInProgress != 0)
                return;

            // === (1) ORB Calculation (captures highest high/lowest low in opening window) ===
            if (CurrentBar == OpeningRangeBars)
            {
                orbHigh = Highs[0][OpeningRangeBars - 1];
                orbLow = Lows[0][OpeningRangeBars - 1];
                for (int i = 1; i < OpeningRangeBars; i++)
                {
                    orbHigh = Math.Max(orbHigh, Highs[0][OpeningRangeBars - 1 - i]);
                    orbLow = Math.Min(orbLow, Lows[0][OpeningRangeBars - 1 - i]);
                }
            }

            // === (2) Entry Logic (all filters) ===
            if (Position.MarketPosition == MarketPosition.Flat)
            {
                double atrVal = atr[0];
                bool trendLong = Close[0] > trendEma[0];
                bool trendShort = Close[0] < trendEma[0];
                bool momentumLong = rsi[0] > RSIMomentumThresh;
                bool momentumShort = rsi[0] < (100 - RSIMomentumThresh);
                bool volumeOK = Volume[0] > volSma[0];

                // Defensive check: don't divide by zero
                double stopDistLong = Math.Abs(Close[0] - (Close[0] - atrVal * AtrMultiplier));
                double stopTicksLong = stopDistLong / TickSize;
                double stopDistShort = Math.Abs(Close[0] - (Close[0] + atrVal * AtrMultiplier));
                double stopTicksShort = stopDistShort / TickSize;
                double dollarsPerTick = TickSize * Instrument.MasterInstrument.PointValue;

                // LONG ENTRY
                if (Close[0] > orbHigh && trendLong && momentumLong && volumeOK
                    && stopTicksLong > 0 && AccountSize > 0 && RiskPercent > 0 && dollarsPerTick > 0)
                {
                    entryPrice = Close[0];
                    stopPrice = entryPrice - atrVal * AtrMultiplier;
                    targetPrice = entryPrice + atrVal * PT_AtrMultiplier;
                    partialTarget = entryPrice + atrVal * PartialTargetMult;

                    double riskDollars = AccountSize * RiskPercent / 100.0;
                    double qty = Math.Floor(riskDollars / (stopTicksLong * dollarsPerTick));
                    if (qty < 1) qty = 1;

                    SetStopLoss("ORB_L", CalculationMode.Price, stopPrice, false);
                    SetProfitTarget("ORB_L", CalculationMode.Price, targetPrice);

                    EnterLong(Convert.ToInt32(qty), "ORB_L");
                    tradeDir = 1;
                    beMoved = partialTaken = trailingActive = false;
                }
                // SHORT ENTRY
                else if (Close[0] < orbLow && trendShort && momentumShort && volumeOK
                    && stopTicksShort > 0 && AccountSize > 0 && RiskPercent > 0 && dollarsPerTick > 0)
                {
                    entryPrice = Close[0];
                    stopPrice = entryPrice + atrVal * AtrMultiplier;
                    targetPrice = entryPrice - atrVal * PT_AtrMultiplier;
                    partialTarget = entryPrice - atrVal * PartialTargetMult;

                    double riskDollars = AccountSize * RiskPercent / 100.0;
                    double qty = Math.Floor(riskDollars / (stopTicksShort * dollarsPerTick));
                    if (qty < 1) qty = 1;

                    SetStopLoss("ORB_S", CalculationMode.Price, stopPrice, false);
                    SetProfitTarget("ORB_S", CalculationMode.Price, targetPrice);

                    EnterShort(Convert.ToInt32(qty), "ORB_S");
                    tradeDir = -1;
                    beMoved = partialTaken = trailingActive = false;
                }
            }

            // === (3) Trade Management ===
            if (Position.MarketPosition != MarketPosition.Flat)
            {
                double atrVal = atr[0];

                // -- Partial Profit: Exits half the position and moves stop to B/E
                if (!partialTaken && tradeDir != 0)
                {
                    if ((tradeDir == 1 && Close[0] >= partialTarget) ||
                        (tradeDir == -1 && Close[0] <= partialTarget))
                    {
                        int currQty = Position.Quantity;
                        int qtyToClose = Math.Max(1, currQty / 2);

                        if (tradeDir == 1)
                            ExitLong(Convert.ToInt32(qtyToClose), "PT_1R", "ORB_L");
                        else
                            ExitShort(Convert.ToInt32(qtyToClose), "PT_1R", "ORB_S");

                        // Move stop to entry after partial
                        double newStop = entryPrice;
                        if (tradeDir == 1)
                            SetStopLoss("ORB_L", CalculationMode.Price, newStop, false);
                        else
                            SetStopLoss("ORB_S", CalculationMode.Price, newStop, false);

                        // Update flags
                        partialTaken = true;
                        beMoved = true;         // Stop was moved to B/E
                        trailingActive = true;  // Enable trailing management
                    }
                }

                // -- Break-even stop (triggered by price move before partial)
                if (!beMoved && tradeDir != 0)
                {
                    if (tradeDir == 1 && High[0] >= entryPrice + atrVal * AtrMultiplierBETrigger)
                    {
                        SetStopLoss("ORB_L", CalculationMode.Price, entryPrice + AtrMultiplierBEOffset * atrVal, false);
                        beMoved = true;
                    }
                    else if (tradeDir == -1 && Low[0] <= entryPrice - atrVal * AtrMultiplierBETrigger)
                    {
                        SetStopLoss("ORB_S", CalculationMode.Price, entryPrice - AtrMultiplierBEOffset * atrVal, false);
                        beMoved = true;
                    }
                }

                // -- Trailing stop for runner (based on swing high/low and ATR buffer)
                if (trailingActive && partialTaken && tradeDir != 0)
                {
                    double newTrail = 0.0;
                    if (tradeDir == 1)
                    {
                        double lbLow = MIN(Low, TrailLookback)[0];
                        newTrail = lbLow - TrailBufferATRMult * atrVal;
                        if (newTrail > stopPrice)
                        {
                            SetStopLoss("ORB_L", CalculationMode.Price, newTrail, false);
                            stopPrice = newTrail;
                        }
                    }
                    else if (tradeDir == -1)
                    {
                        double lbHigh = MAX(High, TrailLookback)[0];
                        newTrail = lbHigh + TrailBufferATRMult * atrVal;
                        if (newTrail < stopPrice)
                        {
                            SetStopLoss("ORB_S", CalculationMode.Price, newTrail, false);
                            stopPrice = newTrail;
                        }
                    }
                }
            }

            // === (4) Flatten at session window end ===
            if (Position.MarketPosition != MarketPosition.Flat && now > TradeEndHHMMSS)
            {
                if (Position.MarketPosition == MarketPosition.Long)
                    ExitLong("Window End Exit", "ORB_L");
                else if (Position.MarketPosition == MarketPosition.Short)
                    ExitShort("Window End Exit", "ORB_S");
            }
        }
    }