Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Call a Strategy

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

    Call a Strategy

    Hello all,
    Is it possible to call a custom ninjascript strategy from within a custom indicator?

    i.e. The indicator detects a specific event and within the indicator code we check to see if this is true, if so, we want to run our strategy which we use to enter the market and put our stop loss, etc.

    #2
    Hello, thanks for your post.

    There is no support for an indicator to call a strategy, you can instantiate indicators within your strategies to use their data while the strategy is running. You can add multiple data series to your script with AddDataSeries() and calculate indicator data for more than just the primary series as well, e.g.

    State.DataLoaded:
    mySMA = SMA(BarsArray[1], 14); //14 period sma set up on the secondary series.

    If you want to submit orders through an indicator, you can also add an Addon style Account object to your indicators and submit orders using the Submit() method. See here for an example of setting that up:

    https://ninjatrader.com/support/help...ount_class.htm

    Please let me know if I can assist any further.

    Comment


      #3
      Chris,
      I'd like to make sure I understand your response. You are saying I can do the opposite; run my strategy which can call my indicator. Since the indicator was called within my strategy it will have all the data available to the indicator?

      Comment


        #4
        Hello, thanks for the follow up.

        Yes, we support indicators being called from strategies. The indicator must expose a public series or a Plot to be available to access from the strategy. For an example of this see the MACD indicator and its public Plot series e.g.

        Code:
        [Browsable(false)]
        [XmlIgnore]
        public Series<double> Avg
        {
            get { return Values[1]; }
        }
        
        [Browsable(false)]
        [XmlIgnore]
        public Series<double> Default
        {
            get { return Values[0]; } 
        }
        
        //and so on
        We also have an example here for study:
        https://ninjatrader.com/support/help...alues_that.htm

        Please let me know if I can assist any further.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        601 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        347 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        559 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        558 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X