Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Error on plotting indicator .........

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

    Error on plotting indicator .........

    Error on plotting indicator 'aaaaaa'. Please check the 'OnBarUpdate' or the 'Plot' method: Overflow error.

    Is there any way I can trap this error and do my own error handling? I am forecasting data and there are times when the forecast goes crazy. Like -2.69860179209617E+18

    Thanks,

    #2
    scjohn,

    Please try using try-catch blocks: http://www.ninjatrader-support2.com/...ead.php?t=9825
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I have lot's of those and I it appears that try-catch will not pick it up. At least not in the OnUpdate() method. My feeling is that this is being thrown inside the NT Charting method and therefore may not be passed back to the user indicator but NT is picking it up.

      What ever bar that the error occurs on, the indicator will no longer be called until an F5 is done. This would seem that this error could not be caught in the OnUpdate() method.
      Last edited by scjohn; 06-29-2009, 09:32 AM.

      Comment


        #4
        try-catch will catch the error if the error is generated from within your try-catch block. If it is not from within the block then it obviously won't catch it. You need to find where your code is breaking and catch it then.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Well I'm pretty sure that this is not coming from the OnUpdate method. That leaves the Plot method and I am not overriding the Plot method in the indicator.

          Comment


            #6
            It is coming from your indicator somewhere. You will just need to try-catch to find it. Remember doing an overarching try-catch in OnBarUpdate() doesn't provide much information. You need to break down each and every individual component.

            I suggest you debug your indicator if you can't find it. Strip it down till the error is not reached and then slowly add components back in.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It would appear that the overflow error is not being generated in the 'OnBarUpDate' method.
              Attached is a snippet the Output Window showing the value that is causing the problem. See second line from the bottom. The value 428164592388069 is being stored in the Plot value Predict[0].

              Here is the code where I have my try - catch in the OnBarUpdate method:
              Code:
              				if(debugLevel >= 1)myInd.Print("AutoNet||Predict 1.0 N = " + N + ". M = " + M +".");
              					for(I=1; I<=N; I++)
              					{
              						for(J=1; J<=M; J++)
              						{
              							ZZ[J] = XSAVE[I, J];
              							if(debugLevel>=2) myInd.Print("AutoNet||PredictNewData 1.1 XSAVE[" + I +"," + J +"]=" + XSAVE[I, J]);							
              						}	//Next J
              						YY = 0.0;
              						COMP( out YY);
              						if(debugLevel >= 1)	myInd.Print("AutoNet||PredictNewData 1.2 Predict[" + (N-I) + "]=" + YY);
              						try
              						{
              							Predictions.Set( N-I,  YY );	//prediction
              						}
              						catch (Exception e)
              						{
              							myInd.Print("AutoNet||PredictNewData NT exception: " + e.ToString() );
              							Predictions.Reset(N-I);
              						}
              					}	//Next I
              if the error was being generated by the - Predictions.Set( N-I, YY ); statement then my try/catch should have caught it. The code continued to run to completion in the OnBarUpdate method. See last line in Output window. The indicator was no longer called for any succeeding bars. Should an overflow error on a particular bar shut down the indicator for all succeeding bars?

              Since I do not use a plot method there is no way for me to see if this is where the overflow is being generated.

              Any suggestions?
              Attached Files

              Comment


                #8
                That could very well be where it originates from, but in this instance try-catch will not necessarily catch it because there is no issue with setting that value to a DataSeries. If you want to know if that is the area in question I suggest you just hard code it to set to another value and then try running. If it doesn't have any problems then you know that was the issue and you will have to tweak your code to address it.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Max238, Today, 01:28 AM
                4 responses
                36 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by r68cervera, Today, 05:29 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by geddyisodin, Today, 05:20 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by timko, Today, 06:45 AM
                2 responses
                14 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by habeebft, Today, 07:27 AM
                0 responses
                7 views
                0 likes
                Last Post habeebft  
                Working...
                X