Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposing indicator values that are not plots AND NOT DATASERIES

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

    Exposing indicator values that are not plots AND NOT DATASERIES

    Hi ,

    I saw an example in


    Regarding NT 6.5 :

    Because of memory considerations I want to avoid creation of additional data series and I want to expose certain indicator value as a property.
    My code is like:

    Indicator A:

    protected override void OnBarUpdate()
    {
    .............
    state1 = [certain value]
    ..........
    }

    Read only property:
    public int IPos
    {
    // read only - for external usage.
    get { return state1 ; }
    }


    Indicator B (or strategy B )
    val1 = IndicatorA(2,10).IPos ;

    There are no compilation errors, but val1 is always 0 , despite the "state1" has different values for different bars.

    I would expect that this statement will return current value of the property for every OnBarUpdate called.

    I suspect my problem has something to do with a way my strategy calls OnBarUpdate().

    What's wrong ?

    #2
    xTrader, if you haven't taken a look at the indicator potion of the sample titled exposing indicator values please do so.

    The code for the publically exposed variable needs to have a section that "updates" the value, like so:
    Code:
    public double ExposedVariable
    {
         // We need to call the Update() method to ensure our exposed variable is up-to-date.
         get { Update(); return exposedVariable; }
    }
    So for your situation, try this and see if it works:
    Code:
    public int IPos
    {
        // read only - for external usage.
        get { Update(); return state1; }
    }
    AustinNinjaTrader Customer Service

    Comment


      #3
      Sorry , I overlooked.

      It appears not only in the example, but also in the help file.

      Now it works. Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, 03-23-2026, 04:31 AM
      0 responses
      69 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      312 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      306 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      146 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      105 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X