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

Looking for the Proper Syntax

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

    Looking for the Proper Syntax

    "double T3Average3 = T3Average(Stochastics(7, 14, 3).K, 0.7, 12)[0];"

    I am trying to put a T3Average on the %K Stochastics via the code. The above syntax compiles without errors, but when I add a T3Average (by clicking the "Indicators" icon) with the same settings to panel 3 for comparison, using the Stochastics as the input series to verify that it's working properly, the compared values are not even close to being the same.

    In other words, I print out the T3Average/Stochastic values in the Output window from my coding and compare it with T3Average/Stochastic values that was manually added to the chart. The 2 don't match. The manually added T3Average/Stochastics is correct. The one from the code isn't.

    Technically, it's working. It's just not giving the correct values.

    Can someone tell me if the above setup for the "double" correct? If not, what can I do to correct the problem?

    Please aware that I'm a novice at programming. Please respond in laymen's terms. Any help would be much appreciated.
    Last edited by RookieTrader; 07-03-2013, 08:02 AM. Reason: for Clarity

    #2
    Hello RookieTrader,

    I am not familiar with this indicator or how it is being calculated. The only thing that I can speculate what is going on is that typically by default, NinjaTrader will add an IDataSeries object that you may pass into an Indicator that the Indicator will use that data for the calculations instead of regular input series divided by the Stochastic.K or any DataSeries that you pass into it.

    You may verify this by plotting the T3Average Indicator on the chart with the same settings and change the Input Series to the Stochastic.K. Here is a video demonstrating how you may do this.
    Download NinjaTrader FREE at http://www.ninjatrader.comThis video demonstrates how to plot an indicator based on the value of another indicator on a chart wi...


    If they match then you may want to calculate it manually inside of the Indicator.
    JCNinjaTrader Customer Service

    Comment


      #3
      JC,

      The method you described and that is demonstrated in the video is exactly what I compared my code inside the indicator to (see jpeg "T3AverageSto Example").

      The syntax seems to be virtually the same:
      syntax from jpeg image (manually added in accordance with video link you sent)
      = T3Average(Stochastics($EURUSD(10 Range),7,14,3).K,0.7,12)
      Code in the indicator = T3Average(Stochastics(7, 14, 3).K,0.7,12)[0]

      Is there any other ways that you can think of to correct the inconsistency?
      Attached Files
      Last edited by RookieTrader; 07-03-2013, 10:14 AM.

      Comment


        #4
        Hello RookieTrader,

        From the screenshot I see that you are using the Stochastic.D instead of the Stochastics.K.

        Could you confirm that the settings are the same?
        JCNinjaTrader Customer Service

        Comment


          #5
          JC,

          The reason that their different, I was trying to set up a proprietary indicator and didn't want to use the actual settings, so I wrote the settings in by hand on both. But I can assure you that the actual settings on both are the identical, both using %K.

          Comment


            #6
            Hello RookieTrader,

            That for the clarification. Unfortunately, I would not know how the T3Average indicator is going to be calculating its values so it would be hard for me to tell what to expect.

            If you would like to share the indicator I can take a quick look to see if I can get them to match, otherwise, you may want to contact the vendor for more information about this.

            Happy to be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              JC,

              Thanks for the help JC. I'll try to figure it out on my own.

              Have a good night.

              Comment


                #8
                JC,

                Just for future reference, on the off chance someone else runs into this problem, the issue was that the T3AverageUp, T3AverageDown & T3AverageNeutral values in the indicator had to be set back to zero after each finished plotting in order to calculate the values correctly.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by frankthearm, Today, 09:08 AM
                7 responses
                29 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by NRITV, Today, 01:15 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by maybeimnotrader, Yesterday, 05:46 PM
                5 responses
                25 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantismo, Yesterday, 05:13 PM
                2 responses
                17 views
                0 likes
                Last Post quantismo  
                Started by adeelshahzad, Today, 03:54 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X