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

Get value from Variable in Indicator . . .

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

    Get value from Variable in Indicator . . .

    So here's where I am at. I created a Indicator that you can set variables for when you setup the Indicator. Settings like Colors, setting for
    the fequency for SMA and a few others. So when I try to get that information from the indicator like

    localSMAPeriod = MyIndicator.SMAPeriod;

    This fails. What I want to do is ultimately set the settings in the Indicator and then refence those in the Strategy so that I can plot those
    values on the Chart to help make buying decisions.

    The way I want to ultimately use it is:

    localSMA = SMA(MyIndicator.SMAPeriod);

    When I try to call the value from the Indicator I get an error. So clearly I am calling that value incorrectly.
    Can anyone point me in the right direction? The indicator is setting the values correctly as I have seen in the
    debug Print statement. This is my last hurdle and I will be happy.

    Thanks.

    #2
    Hello ATMtrader0001,

    You are getting an error?

    What is the error?


    The MyIndicator.SMAPeriod is throwing me off a bit.
    Is this in a different namespace or something?
    Is MyIndicator a variable holding an indicator and you are trying to get a property from it?

    Why is the MyIndicator. added to the front of this?

    Take a look at the SMA indicator to see how the public Period input is created and the attributes applied.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Sorry, I was not at my usual computer and could not post the error.

      After getting some sleep I found the issue. I am able to get the value from the parameters now.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by elirion, Today, 01:36 AM
      0 responses
      3 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by gentlebenthebear, Today, 01:30 AM
      0 responses
      3 views
      0 likes
      Last Post gentlebenthebear  
      Started by samish18, Yesterday, 08:31 AM
      2 responses
      9 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by Mestor, 03-10-2023, 01:50 AM
      16 responses
      389 views
      0 likes
      Last Post z.franck  
      Started by rtwave, 04-12-2024, 09:30 AM
      4 responses
      34 views
      0 likes
      Last Post rtwave
      by rtwave
       
      Working...
      X