Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to apply Indicator/Strategy to one stock being selected from a list of stocks?

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

    How to apply Indicator/Strategy to one stock being selected from a list of stocks?

    Indicator/Strategy can be easily applied to one selected stock through a stock chart. In other words, as long as I already know the stock, I can apply NT8 to use my strategy. What if I need to screen a list of stocks and only apply the Indicator/strategy to the selected stocks, do you have any sample code for stock screening purpose and then apply the strategies? Thanks a lot in advance.

    #2
    Hello localappleseed, thanks for your post.

    Strategies need to be enabled on an instrument by instrument case by the user. In a strategy and indicator, you can add multiple data series to the script using AddDataSeries, this can be used to apply conditions to multiple instruments. See here for a guide on using multi time frame and instrument scripts:

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

    Another way of doing this would be to make a Market Analyzer Column script that produces a signal, then apply that indicator in the Market Analyzer. When you get the signal from the indicator on one of the rows in the column, apply your strategy to that instrument.
    https://ninjatrader.com/support/help...t_analyzer.htm

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the answer.
      AddDataSeries(string instrumentName, BarsPeriod barsPeriod) can add BarPeriod for different Instruments. So this allows one scripts handle different Instruments. But it seems to me this is only applicable to Bars/Charts. How about Level 2 data book? Can I use AddDataSeries to add a different instruments to get its Level 2 Data Book?

      In other words, I can get different BarPeriods for different instruments, can I also get level 2 data book for different instruments?
      Last edited by localappleseed; 08-21-2020, 03:44 PM.

      Comment


        #4
        Hello localappleseed, thanks for your reply.

        Yes, you can. See the first tip on this page:

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

        The idea being the OnMarketDepth method will be called in the context of the BarsInProgress index.

        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by JGriff5646, Today, 10:02 PM
        0 responses
        1 view
        0 likes
        Last Post JGriff5646  
        Started by AdamDJ8, Today, 09:18 PM
        0 responses
        2 views
        0 likes
        Last Post AdamDJ8
        by AdamDJ8
         
        Started by knowmad, Today, 03:52 AM
        2 responses
        27 views
        0 likes
        Last Post knowmad
        by knowmad
         
        Started by ETFVoyageur, Today, 07:05 PM
        0 responses
        10 views
        0 likes
        Last Post ETFVoyageur  
        Started by Orion815, 05-02-2024, 08:39 AM
        2 responses
        18 views
        0 likes
        Last Post Orion815  
        Working...
        X