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

accessing other indicators or instruments

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

    accessing other indicators or instruments

    Hi,

    is there any possibility to access other indicators from a certain indicator script?
    For example, the script would be that of a divergence indicator and in case there is a divergence I would like plot lines on both the primary dataseries where the divergence indi is applied to and the second dataseries, which could be eighter an instrument or another indicator.

    #2
    Hello Stephan123,

    Yes, you can access multiple instruments in NinjaScript. There is a sample built in that you can see for reference. Click tools > Edit NinjaScript > Strategy > SampleMultiInstrument.
    Documentation for this is available here:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I know about this.
      But, what I'm looking for is not only to virtuelly calculate a second indicator
      or instrument within the script of my custom indicator but to plot a second indicator or instrument and to place drawing objects on them in the chart just by applying that custom indicator.
      For example, if the custom indicator is a divergence indicator,
      I want it to plot the second instrument/indicator on the chart and to draw
      divergence lines on both the first instrument and the added instrument/indicator.

      Comment


        #4
        Yes, in version 7 you can use multiple instruments in your indicator scripts. It works the same way as in a strategy where the series is added in Initialize() and you reference using BarsArray, Highs, Closes, etc.

        Drawing objects can be assigned either to be placed on the panel they're in, or on the price panel. This is controlled with property DrawOnPricePanel.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Can the property DrawOnPricePanel be dynamically set within the OnBarUpdate method? Therefore I could draw both on the indicator and the price data.

          Is it possible to draw a second candlestick chart with price data within the script of an indicator?
          That means not only making another instrument accessable for calculation purposes
          but also displaying it in the chart just by applying the custom indicator.

          Comment


            #6
            Some people use this approach and report that it works ok for their uses. We only support setting this property one time in Initialize().

            Yes, it's possible to have NinjaTrader plot values from other indicators. This is pretty straightforward if you are only plotting one value at a time, like the closing value of another instrument. It is possible draw custom candlesticks, which requires overriding the plot method. We are not able to support overriding the plot method but you can see one example with the HeikenAshi indicator.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by PaulMohn, Today, 03:49 AM
            0 responses
            4 views
            0 likes
            Last Post PaulMohn  
            Started by inanazsocial, Today, 01:15 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by rocketman7, Today, 02:12 AM
            0 responses
            10 views
            0 likes
            Last Post rocketman7  
            Started by dustydbayer, Today, 01:59 AM
            0 responses
            2 views
            0 likes
            Last Post dustydbayer  
            Started by trilliantrader, 04-18-2024, 08:16 AM
            5 responses
            23 views
            0 likes
            Last Post trilliantrader  
            Working...
            X