Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 IsValidDataPoint causes Exception when used on Indicator Plot

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

    NT8 IsValidDataPoint causes Exception when used on Indicator Plot

    Hello,

    I defined an indicator using the Wizard and it produced the following code:

    AddPlot(Brushes.Transparent, "TwTOP");
    AddPlot(Brushes.Transparent, "TwBOT");
    AddPlot(Brushes.Transparent, "TwRiskDlr");
    AddPlot(new Stroke(Brushes.OrangeRed, 2), PlotStyle.Dot, "TwStopLoss");

    I also defined these Series<T>

    upTrend = new Series<bool>(this, MaximumBarsLookBack.Infinite);
    twDlyTrendCnt = new Series<double>(this, MaximumBarsLookBack.Infinite);
    twTrendBarCnt = new Series<double>(this, MaximumBarsLookBack.Infinite);
    twBarColor = new Series<string>(this, MaximumBarsLookBack.Infinite);

    The indicator works fine, but when I try to test for IsValidDataPoint(0) in OnBarUpdate, on both the Plots and Series<T> from within a Strategy, the statements that reference the Plots fail with exception....

    IsValidDataPoint cannot be used on a series running with MaximumBarsLookBack.TwoHundredFiftySix

    What I`m trying to do is.. convert a strategy from NT7 to NT8 using NT8.0.0.8 64bit.

    In NT7 the code is:
    if (!AuLbTradeWindow(false, false, false, false, dblDollarSL, 50).twTOP.ContainsValue(0)) { Print("twTOP has no value @Time=" + Time[0].ToString()); }

    In NT8 I rewrote to be:
    if (!AuLbTradeWindow(false, false, false, false, 50, DblDollarSL).TwTOP.IsValidDataPoint(0)) { Print("twTOP has no value @Time=" + Time[0].ToString()); bolError = true; }

    I understood from the documentation that plots should be checked for valid values.

    Should the definition of the indicator plots be defined differently to allow a strategy to check IsValidDataPoint ?

    Could you please let me know what I may have done wrong here OR is this something not quite right with NT8.0.0.8 ?

    Thank you

    #2
    Hello rayko,

    Thanks for your post.

    We would expect that error, "MaximumBarsLookBack.TwoHundredFiftySix" when it is set that way, the code you are showing says it is set to MaximumBarsLookBack.Infinite.

    Please post your complete code if possible. If you prefer to keep it private, feel free to send in to PlatformSupport[at]NinjaTrader[dot]Com In the subject line place Atten:Paul and a link to this thread.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      I put together an example of how it produces an error so that you can test it at your end.

      I`ve uploaded an NT8 export of MyIndicator and MyStrategy and screen print of the error showing on the NT log.

      Please let me know.
      Attached Files

      Comment


        #4
        Hello rayko,

        Thank you for your patience.

        In your indicator, you would also need to define MaximumBarsLookBack. For example:
        Code:
        			if (State == State.SetDefaults)
        			{
        				Description							= @"Enter the description for your new custom Indicator here.";
        				Name								= "MyIndicator";
        				Calculate							= Calculate.OnBarClose;
        				IsOverlay							= true;
        				DisplayInDataBox					= true;
        				DrawOnPricePanel					= true;
        				DrawHorizontalGridLines				= true;
        				DrawVerticalGridLines				= true;
        				PaintPriceMarkers					= true;
        				ScaleJustification					= NinjaTrader.Gui.Chart.ScaleJustification.Right;
        				//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
        				//See Help Guide for additional information.
        				IsSuspendedWhileInactive			= true;
        				[B]MaximumBarsLookBack					= MaximumBarsLookBack.Infinite;[/B]
        
                        AddPlot(Brushes.Transparent, "TwTOP");
                        AddPlot(Brushes.Transparent, "TwBOT");
                        AddPlot(Brushes.Transparent, "TwRiskDlr");
                        AddPlot(new Stroke(Brushes.OrangeRed, 4), PlotStyle.Dot, "TwStopLoss");
                    }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 09:43 PM
        0 responses
        3 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        36 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X