• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IsValidDataPoint and MaximumBarsLookBack256

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

    IsValidDataPoint and MaximumBarsLookBack256

    This help documentation says:

    Warning: Calling IsValidDataPoint() will only work a MaximumBarsLookBackInfinite series. Attempting to check IsValidDataPoint() MaximumBarsLookBack256 series throw an error.
    Meanwhile this forum page provides some examples which work for me in NinjaTrader 8 even when the indicators are set to MaximumBarsLookBack256.

    Specifically SampleEveryNBarTest contains this code:

    Code:
            protected override void OnBarUpdate()
            {
                /* Checks to see if the current bar has a valid indicator plot value set on indicator plot: Value. It is important to check this to know if the values you are
                 using are relevant or not. Using irrelevant values for your script logic can cause inaccurate calculations and trade signals. */
                if(!SampleEveryNBar(N).Value.IsValidDataPoint(0))
                {
                    // SampleEveryNBar does not have a valid indicator plot value. Set hosting indicator's plot to zero and paint the bar red.
                    BarBrushes[0] = Brushes.Red;
                    PlotBrushes[0][0] = Brushes.Red;
                    Value[0]= 0;
                }
                else
                {
                    // SampleEveryNBar does have a valid indicator plot value. Set hosting indicator's plot to this value and paint the bar blue.
                    BarBrushes[0] = Brushes.Blue;
                    PlotBrushes[0][0] = Brushes.Blue;
                    double val = SampleEveryNBar(N).Value[0];
                    Value[0] = val;
                }
            }
    And when I added to my chart, I used MaximumBarsLookBack256:

    Click image for larger version  Name:	Capture.PNG Views:	1 Size:	34.8 KB ID:	1054909

    Can you help clarify whether the documentation is wrong or misleading on this? Or specifically under what circumstances the maximum lookback becomes a problem?

    Thanks,
    Steve

    Last edited by Steve L; 04-20-2019, 12:58 PM.
    Steve L
    NinjaTrader Ecosystem Vendor - Ninja Mastery

    #2
    Hello Steve L,

    The example provided does not use a secondary data series or have any custom series.

    The primary series will always be MaximumBarsLookBack.Infinite and this is not possible to change.

    If a secondary series is added, that series must be Infinite to use IsValidDataPoint().
    https://ninjatrader.com/support/help...rslookback.htm
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by walter739, Today, 11:56 AM
    2 responses
    6 views
    0 likes
    Last Post walter739  
    Started by kevinfloresz, Today, 09:46 AM
    2 responses
    21 views
    0 likes
    Last Post kevinfloresz  
    Started by digibob, 12-13-2019, 10:01 PM
    6 responses
    17 views
    0 likes
    Last Post bltdavid  
    Started by TraderJim618, Today, 11:24 AM
    0 responses
    4 views
    0 likes
    Last Post TraderJim618  
    Started by NT-Roland, Today, 10:03 AM
    1 response
    10 views
    0 likes
    Last Post Lancer
    by Lancer
     
    Working...
    X