Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposing Values

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

    Exposing Values

    Good morning,

    I have and indicator with 2 different time frames. I am trying to have 2 different Values called, one for each time frame.

    Under addplot() in the language reference it show and example using Values[0] and then Values[1]. This example below seems to work fine as an indicator.


    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    {
    if(High[1][0] > High[1][1])
    {
    Value[0][0] = 1;
    }
    else
    {
    Value[0][0] = 0;
    }
    }

    if (BarsInProgress == 2)
    {
    if(High[2][0] > High[2][1])
    {
    Value[1][0] = 2;
    }
    else
    {
    Value[1][0] = 0;
    }
    }​
    }


    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MyPlot
    {
    get { return Values[0]; }
    }


    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MyPlot2
    {
    get { return Values[1]; }
    }



    But when I go to reference this in a strategy I can't seem to get the strategy to recognize Values[1]. Example below of strategy. Any help would be greatly appreciated. Thanks, Ryan


    protected override void OnBarUpdate()
    {​
    if(MyIndicator1[0] == 1)
    {
    EnterLong();
    }
    if(MyIndicator1[0] == 2)
    {
    EnterLong();
    }
    ​​​​​​​}​
    Last edited by Tonkingrf1551; 08-18-2023, 08:11 AM.

    #2
    Hello Tonkingrf1551,

    From the strategy you would want to reference the plot.

    private MyCustomIndicatorName MyIndicator;

    In OnBarUpdate():

    Print( MyIndicator.MyPlot2[0] );

    Note, that plot series will only be synchronized with the primary series.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    573 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X