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

Getting values from loaded indicator?

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

    Getting values from loaded indicator?

    Hello,

    I was wondering if it is technically possible to get values from an indicator currently loaded on a chart to pass them on onto another indicator loaded on the same chart.

    My programming skills are pretty basic, but I have normally managed to complete any tasks required to achieve a goal, although probably not in the most efficient way.

    At the moment what I do is to code indicators within another indicator, which means that the list of parameters I used in the indicator containing other indicators gets longer and longer, and when I change the parameters in the first indicator (used as input in the second one) then I have to also change the parameters in the second indicator, a process which gets tedious and subject to human error.

    I have been reading a bit about User Defined Methods, and was wondering if a solution to this problem could be found there.

    Please advice if that is the route I should explore (any other hints welcome!)

    Thanks,

    Stopped

    #2
    Hi Stopped, sorry not following what you would like to do - if you need indicator values from another indicator you can just call the indicator method in the script, there would be no need / way to directly access an explicit indicator loaded on a chart.

    Have a good Sunday,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Thanks for your quick reply on a weekend!

      I did not explain myself correctly. Let's try again using a very simple example:
      1. Let's say I load the SMA (Period) indicator onto a chart, with Period set to 20.
      2. Now suppose I load a second indicator, MAX(SMA(SMA Period), Lookback), and that I would like the SMA Period parameter (customisable) to match the Period parameter of the first indicator. For completeness, let's assume I set Lookback to 10, so we have MAX(SMA(20), 10).
      3. For whatever reason I decide I would like to change the input on the first indicator to 10 from 20, so it becomes SMA (10).
      4. Now, however, the second indicator uses a parameter that no longer matches the one on the first indicator. So I click on the Indicators button to change the SMA Period parameter on the second indicator to 10.
      This is all OK I guess, but I was wondering if there is a way to code the second indicator in a way that whenever I decide to change the Period parameter in the first indicator this would feed into the second indicator by automatically adjusting the SMA Period parameter as well.

      Thanks in advance,

      Stopped

      Comment


        #4
        Thanks for the clarification, this would only work if you coded one complete indicator doing the different plots based on your custom criteria, you could then define user defined inputs for the indicator that could be used in various method calls in the code so all would as just per your inputs as desired.

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bertrand,

          Thanks for that suggestion.

          Can I use a combined indicator to plot graphs in separate panels? Or would I need to create more than one indicator in that case?

          Cheers,

          Stopped

          Comment


            #6
            You're welcome - you would need an indicator per panel then, as you could not draw to specific panels via the code.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bc24fl, 08-30-2019, 01:58 PM
            3 responses
            255 views
            0 likes
            Last Post PaulMohn  
            Started by tradingnasdaqprueba, 04-09-2024, 09:52 AM
            6 responses
            28 views
            0 likes
            Last Post tradingnasdaqprueba  
            Started by PaulMohn, Today, 02:06 AM
            1 response
            3 views
            0 likes
            Last Post PaulMohn  
            Started by Mindset, Today, 01:27 AM
            0 responses
            5 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by EB Worx, 03-07-2023, 05:05 AM
            4 responses
            99 views
            1 like
            Last Post cls71
            by cls71
             
            Working...
            X