Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New NinjaScript NT8

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    New NinjaScript NT8

    I want to write a few indicators for NT8 that I have programmed in the past for NT7. I can't seem to find the new Ninjascript area on NT8. Any help would be greatly appreciated.

    #2
    Hello,
    You can create a NinjaScript Editor by going to New> NinjaScript Editor. There have been changes made to the NinjaScript Editor I would recommend to review the following link: http://ninjatrader.com/support/helpG...us/editor.htm\

    I would also recommend reviewing the Code Breaking Changes at the following link: http://ninjatrader.com/support/helpG...ng_changes.htm
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      //This namespace holds Indicators in this folder and is required. Do not change it.
      namespace NinjaTrader.NinjaScript.Indicators
      {
      public class Aindicator : Indicator
      {
      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = @"Enter the description for your new custom Indicator here.";
      Name = "Aindicator";
      Calculate = Calculate.OnBarClose;
      IsOverlay = false;
      DisplayInDataBox = true;
      DrawOnPricePanel = true;
      DrawHorizontalGridLines = true;
      DrawVerticalGridLines = true;
      PaintPriceMarkers = true;
      ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
      //Disable this property if your indicator requires custom values that cumulate with each new market data event.
      //See Help Guide for additional information.
      IsSuspendedWhileInactive = true;
      AddPlot(Brushes.Orange, "Test1");
      }
      else if (State == State.Configure)
      {
      }
      }

      protected override void OnBarUpdate()
      {
      PlotBrushes[0][0] = Brushes.Green;
      }

      Comment


        #4
        Hello,
        It appears that you have pasted some of your code as a response. Can you clarify how we can assist?
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          In the above code I was attempting to plot a 0 line for an oscillator type indicator. Nothing plots however if anyone can help it would be greatly appreciated.

          Comment


            #6
            Hello,
            In your code you have not set the plot to anything.
            To set the plot you will need to set the Value for the plot.
            For example the following would set the plot to the close of the current bar plus two ticks:
            Code:
            protected override void OnStateChange()
            		{
            			if (State == State.SetDefaults)
            			{
            				Description							= @"Enter the description for your new custom Strategy here.";
            				Name								= "MyCustomStrategy1";
            				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.Gtc;
            				TraceOrders							= false;
            				RealtimeErrorHandling				= RealtimeErrorHandling.StopCancelClose;
            				StopTargetHandling					= StopTargetHandling.PerEntryExecution;
            				BarsRequiredToTrade					= 20;
            			}
            			else if (State == State.Configure)
            			{
            			
            				AddPlot(Brushes.Green, "Plot A");
            			}
            		}
            
            		protected override void OnBarUpdate()
            		{
            			//Add your custom strategy logic here.
            			Value[0] = Close[0] + 2* TickSize;
            		}
            	}
            For more information on setting values please see the following link: https://ninjatrader.com/support/help...n-us/value.htm
            Cody B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X