• 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, 01: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 haulalowatt, Today, 02:02 AM
    0 responses
    2 views
    0 likes
    Last Post haulalowatt  
    Started by ntbone, Yesterday, 08:10 PM
    0 responses
    8 views
    0 likes
    Last Post ntbone
    by ntbone
     
    Started by chrislou, 08-28-2015, 03:27 AM
    14 responses
    2,881 views
    0 likes
    Last Post nkhoi
    by nkhoi
     
    Started by outofstock, Yesterday, 06:40 PM
    2 responses
    8 views
    0 likes
    Last Post outofstock  
    Started by saeed, Yesterday, 12:32 PM
    3 responses
    41 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Working...
    X