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

pickup variable from another indicator on same chart

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

    pickup variable from another indicator on same chart

    i'd like to pick up the Period variable from the @CCI indicator on my chart and use it "automatically" as the period for an indicator i'm developing. not so fluent in programming and i feel like i'm wasting a bunch of time....
    is this possible?
    thanks,
    w

    #2
    Hello stafe,
    Yes, you can do it. Please refer to this sample code which demonstrates it further.


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      thanks for the link...
      that's a good example of how to setup a variable within an indicator
      (as is the case with the @CCI indicator code)

      my interest is in having an additional indicator pickup the int variable of Period that is used to plot the CCI below the price chart (pricepanel) and use that same Period int in an indicator that plots signals on the price chart (price panel) -- without having to manually enter a matching int for the period on the 2nd indicator that is plotting on the price panel.
      /w

      Comment


        #4
        Hello stafe,
        Are you trying to expose values which are not plots? If so please refer to this sample code which further demonstrates it
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I'm also interested in the same functionality as stafe is describing. I believe what stafe is asking for is, for example, suppose you have an SMA indictator on a chart with 30 as the Period. If I add a custom indicator to this same chart, how can that custom indicator get the period that is being used on the SMA indicator (i.e., 30 in this example)?

          This way the custom indicator can use the 30 period for it's own purposes rather than the user having to manually specify a 30 period for the SMA indicator AND manually specify a 30 period for the custom indicator as well. Furthermore, if the user changes the period on the SMA indicator to 50, then the custom indicator should begin using 50 for it's own period value.
          Last edited by overflowing; 08-17-2012, 08:40 PM.

          Comment


            #6
            overflowing, you've got it on the money...
            sometimes i have trouble making myself clear, thanks

            i'd like to link a custom indicator's Period variable value to the Period variable value on a, let's call it, period source indicator on the same chart - so that - when the "period source" indicator period is changed so too are the other indicators that are linked to the "period source" indicator's period...

            @CCI(14) - period source indicator on a 5min chart of /6E
            CUSTOM1 - period is linked to that of @CCI which is currently 14
            CUSTOM2 - period is linked to that of @CCI which is currently 14
            CUSTOM3 - period is linked to that of @CCI which is currently 14
            CUSTOM4 - period is linked to that of @CCI which is currently 14
            CUSTOM5 - period is linked to that of @CCI which is currently 14
            CUSTOM6 - period is linked to that of @CCI which is currently 14
            CUSTOM7 - period is linked to that of @CCI which is currently 14
            CUSTOM8 - period is linked to that of @CCI which is currently 14
            CUSTOM9 - period is linked to that of @CCI which is currently 14

            change @CCI(14) to @CCI(12) period changed to 12 on period source indicator
            and
            CUSTOM1, CUSTOM2, CUSTOM3,CUSTOM4, CUSTOM5, CUSTOM6,CUSTOM7, CUSTOM8, and CUSTOM9
            all change to a period of 12 because they are linked to @CCI as a Period value source...

            is there a way?
            ¿there must be a way to link a custom indicator's Period variable int Value to another indicator on the same chart...?

            the Period variable Value is an "exposed" Public variable already...
            so that's not an issue...6=.5x12

            please excuse my programming ignorance
            COBAL was the last language i knew anything about.... LOL

            Comment


              #7
              This is what dukeb is doing, getting the period of chart/data series. He's extracted out 30 and minutes and the name.

              You could hide your indicators setup values, and use this to automatically set it.





              Originally posted by stafe View Post
              overflowing, you've got it on the money...
              sometimes i have trouble making myself clear, thanks

              i'd like to link a custom indicator's Period variable value to the Period variable value on a, let's call it, period source indicator on the same chart - so that - when the "period source" indicator period is changed so too are the other indicators that are linked to the "period source" indicator's period...

              @CCI(14) - period source indicator on a 5min chart of /6E
              CUSTOM1 - period is linked to that of @CCI which is currently 14
              CUSTOM2 - period is linked to that of @CCI which is currently 14
              CUSTOM3 - period is linked to that of @CCI which is currently 14
              CUSTOM4 - period is linked to that of @CCI which is currently 14
              CUSTOM5 - period is linked to that of @CCI which is currently 14
              CUSTOM6 - period is linked to that of @CCI which is currently 14
              CUSTOM7 - period is linked to that of @CCI which is currently 14
              CUSTOM8 - period is linked to that of @CCI which is currently 14
              CUSTOM9 - period is linked to that of @CCI which is currently 14

              change @CCI(14) to @CCI(12) period changed to 12 on period source indicator
              and
              CUSTOM1, CUSTOM2, CUSTOM3,CUSTOM4, CUSTOM5, CUSTOM6,CUSTOM7, CUSTOM8, and CUSTOM9
              all change to a period of 12 because they are linked to @CCI as a Period value source...

              is there a way?
              ¿there must be a way to link a custom indicator's Period variable int Value to another indicator on the same chart...?

              the Period variable Value is an "exposed" Public variable already...
              so that's not an issue...6=.5x12

              please excuse my programming ignorance
              COBAL was the last language i knew anything about.... LOL

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DayTradingDEMON, Today, 09:28 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              8 responses
              31 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by helpwanted, Today, 03:06 AM
              2 responses
              22 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by navyguy06, Today, 09:28 AM
              0 responses
              5 views
              0 likes
              Last Post navyguy06  
              Started by rjbtrade1, 11-30-2023, 04:38 PM
              2 responses
              77 views
              0 likes
              Last Post DavidHP
              by DavidHP
               
              Working...
              X