Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Signal for different security

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

    Signal for different security

    Hi,

    In NinjaScript, what code do I use for the following:

    When my indicators produce a signal to go Long equities, say on my ES chart, what code do I use to Enter a Long position on a different security, such as the XLF?

    Vice Versa for Shorts.

    Thank you,

    #2
    Hello,

    You would need to create a multi-instrument strategy to do so.

    Please have a look at our sample under Tools--> Edit NinjaScript--> Strategy--> SamleMultiInstrument

    More information on these options can be found below:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Back to this Multi-Instrument Strategy question.

      In the Sample Multi-Instrument Strategy example on Line 67 the code is:
      (ADX(14)[0] > 30 && ADX(BarsArray[1], 14)[0] > 30)

      1) In my Multi-Instrument Strategy that I am trying to build I am not using ADX but a custom indicator. How do I effectively remove this code? I am not concerned about if a "both instruments are trending". Currently if I just delete the line I am not able to Enable the strategy.

      2) When keeping the above line of code in the strategy I can Enable the strategy but how do I have the 2nd symbol be traded and not the primary security? For example if I place the Sample MI Strategy on M6B 03-13 and want M6E 03-13 to be traded the strategy is still trading M6B.

      Thank you,

      Comment


        #4
        Originally posted by Scarlett09 View Post
        Back to this Multi-Instrument Strategy question.

        In the Sample Multi-Instrument Strategy example on Line 67 the code is:
        (ADX(14)[0] > 30 && ADX(BarsArray[1], 14)[0] > 30)

        1) In my Multi-Instrument Strategy that I am trying to build I am not using ADX but a custom indicator. How do I effectively remove this code? I am not concerned about if a "both instruments are trending". Currently if I just delete the line I am not able to Enable the strategy.
        Could you attach the script you're using so that I can examine it. As the sample strategy I have is not the same as yours and I want to verify any changes you've made

        you can find it in (MY)Documents\NinjaTrader 7\bin\Custom\Strategy

        2) When keeping the above line of code in the strategy I can Enable the strategy but how do I have the 2nd symbol be traded and not the primary security? For example if I place the Sample MI Strategy on M6B 03-13 and want M6E 03-13 to be traded the strategy is still trading M6B.
        You have to use the enter overload that allows you to input the barsInProgressIndex

        EnterLong(int barsInProgressIndex, int quantity, string signalName)

        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X