Announcement

Collapse
No announcement yet.

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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X