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

Indicators work by themselves, not when nested

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

    Indicators work by themselves, not when nested

    I have two indicators I converted to NT8 from NT7. They seem to work by themselves, comparing to NT7. The problem is when I use one indicator as the input for the other. What could the possible issue be? I have scoured the code and can't find anything. I changed the prices series in the relevant indicators as Input rather than Close.

    #2
    Hello ericson,

    Have you added any prints to your script to ensure the data in is the same?
    Are you finding that each bar prints the same price for the price series you are using in the calculations?

    Do you have multiple series in the script?

    Are you able to reproduce this behavior using NinjaTrader system indicators?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      You need to look at if you are getting the same data in to be calculated. Print out your calculations and debug.

      Comment


        #4
        Have you added any prints to your script to ensure the data in is the same?
        No
        Are you finding that each bar prints the same price for the price series you are using in the calculations?
        N/A

        Do you have multiple series in the script?
        Yes i think

        Are you able to reproduce this behavior using NinjaTrader system indicators?
        No just the converted indicators

        Comment


          #5
          Hello ericson,

          You will need to add prints to your script and ensure you are using the same data.

          Below is a link to a video that demonstrates using prints to understand behavior.
          Describes the elements of a string.Format() call. Used to debug a script to understand behavior.


          Please print the value of each bar with a timestamp and provide the output for both NT7 and NT8.

          You mention that you are using a secondary series in the script with AddDataSeries(). Have you ensured that any added series in the hosted script is also added to the host script?

          From the help guide:
          "Should your script be the host for other scripts that are creating indicators and series dependent resources in State.DataLoaded, please make sure that the host is doing the same AddDataSeries() calls as those hosted scripts would. For further reference, please also review the 2nd example below and the 'Adding additional Bars Objects to NinjaScript' section in Multi-Time Frame & Instruments"
          AddDataSeries() - http://ninjatrader.com/support/helpG...dataseries.htm
          Multi-Time Frame & Instruments - http://ninjatrader.com/support/helpG...tToninjascript
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Could there be a problem if the indicator used at input repaints?

            Comment


              #7
              Hello ericson,

              Can you clarify what you mean by repaints?

              Are you doing custom rendering in OnRender()?

              Is this rendering using data from a price series?
              Are the prices in the prices series the same?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Is it possible to send the indicators to customer service privately to find the problem?

                Repaints means as new bars built the plot changes for the period in which the indicator was set. Historical bars before the period is set though.

                Output plot is "1" the entire chart, moves fractions from 1.

                Not using onrender or another dataseries.

                Indicators compatible with NT8
                Last edited by ericson; 02-01-2017, 03:11 PM.

                Comment


                  #9
                  Hello ericson,

                  The NinjaTrader Platform Support can be reached by emailing platformsupport [at] ninjatrader [dot] com.

                  Below I am linking the contact page for NinjaTrader.
                  If you have any questions, concerns or feedback, or want to open an account, we're here to help. Click here to find the appropriate contact for your needs!


                  I'm not quite understanding the behavior you are describing.

                  Are you saying that the script will retroactively set plot values for historical bars (changing the historical values after those bars have passed)?

                  If both scripts do this, perform the same calculations, and both change the values of pltos historically the same, the values should still be the same.
                  Until you know the data is the same, it wouldn't be possible to tell as the different data would cause different values and you would not be able to tell if the calculation is correct.

                  Have you added any prints to either script to ensure the data is the same?

                  May we have the output that has appeared in the output window so that we may assist in analyzing the output?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    First indicator (not used at input), while second indicator is used as input. Refreshed ninjascript on chart.

                    Code:
                    if (CurrentBar == 0)
                    			{return;}
                    			
                    			
                    			numerator[0] = (Input[0] - SMA(Input, Range)[0]); 
                    			denominator[0] = (StdDev(Input, Range)[0]);
                    			
                    			if//(denominator[0]<0.000000000001 && denominator[0]>-0.000000000001)
                    				 //(denominator[0].CompareTo(0) == 0)// Check to make sure you are not dividing by zero
                    				 (denominator[0] == 0)// Check to make sure you are not dividing by zero
                    			 {Z[0] = (CurrentBar == 0 ? 50 : Z[1]);}
                    			else
                    			{Z[0] = (numerator[0] / denominator[0]);
                    			Print("Bar "+CurrentBar.ToString()+" :"+Z[0].ToString());
                    Attached Files
                    Last edited by ericson; 02-02-2017, 06:53 AM.

                    Comment


                      #11
                      Second Indicator used as input to first. The loop changes the number several times. Had to only get the first number in the loop. File too big. Snippet of code:

                      Code:
                                              for(n=i0;n<=i0+p;n++)
                      			{
                      				sum=0;
                      				for(kk=1;kk<=degree;kk++)
                      				{
                      				sum+=x[kk+1]*Math.Pow(n,kk);
                      				}
                      				Fx[n] = (x[1]+sum);//n
                      				if(Fx[n] == Fx[0])
                      				{Print("Bar "+CurrentBar.ToString()+" :"+Fx[0].ToString());}
                      			}
                      Attached Files
                      Last edited by ericson; 02-02-2017, 06:54 AM.

                      Comment


                        #12
                        The line is at 1
                        Attached Files
                        Last edited by ericson; 02-02-2017, 06:34 AM.

                        Comment


                          #13
                          Here is the output of the indicators separated.
                          Attached Files

                          Comment


                            #14
                            Charts separated indicators
                            Attached Files

                            Comment


                              #15
                              These are outputs in NT7, which work, Indicator 2 is input for indicator 1. Used same data series time frame.
                              Attached Files
                              Last edited by ericson; 02-02-2017, 07:10 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by adeelshahzad, Today, 03:54 AM
                              5 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by stafe, 04-15-2024, 08:34 PM
                              7 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by merzo, 06-25-2023, 02:19 AM
                              10 responses
                              823 views
                              1 like
                              Last Post NinjaTrader_ChristopherJ  
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              21 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X