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 Balage0922, Today, 07:38 AM
      0 responses
      1 view
      0 likes
      Last Post Balage0922  
      Started by JoMoon2024, Today, 06:56 AM
      0 responses
      6 views
      0 likes
      Last Post JoMoon2024  
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      19 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      6 views
      0 likes
      Last Post Creamers  
      Started by Segwin, 05-07-2018, 02:15 PM
      12 responses
      1,786 views
      0 likes
      Last Post Leafcutter  
      Working...
      X