Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Paste indictor script in Strategy

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

    Paste indictor script in Strategy

    Good morning,

    I built an indicator, but I want to copy and paste the entire script into a strategy instead of adding the indicator as a private variable in the public class scope of the strategy. Is this possible?

    #2
    Hello AdeptistJune,

    You can copy logic from one script to another.

    Below is a link the NinjaScript Editor 401 training video which discusses this.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      AdeptistJune I do not think you really want to copy your code from an indicator to a strategy what you want to do is leverage your indicator in a strategy they will get out of sync quickly

      Ninja Documentation

      search AddChartIndicator()


      Take the case of having an indicator with a name of IndicatorName

      Create a reference to it


      indicator named: MyIndicator
      strategy named: MyStrategy

      Under Public Class MyClass
      private IndicatorNameMyIndicator;

      under else if (State == State.DataLoaded)
      MyIndicator = InicatorName(Period,StopTicks,Risk_Planned);
      MyIndicator.Panel=2;
      AddChartIndicator(MyIndicator);

      In onBarUpdate

      MyIndicator.Monitored_item[0]

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X