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 llanqui, Today, 10:32 AM
      0 responses
      1 view
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by StockTrader88, 03-06-2021, 08:58 AM
      45 responses
      3,992 views
      3 likes
      Last Post johntraderuser2  
      Started by TAJTrades, Today, 09:46 AM
      0 responses
      7 views
      0 likes
      Last Post TAJTrades  
      Started by rhyminkevin, Yesterday, 04:58 PM
      5 responses
      62 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by realblubb, Today, 09:28 AM
      0 responses
      8 views
      0 likes
      Last Post realblubb  
      Working...
      X