Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

dataSeries problem

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

    dataSeries problem

    Hi,
    I got a strategy that use the stochastics with some parameters. I trade in real time and plot the stochastics. The stochastic in the script when prited is far away from the stochastics ploted.

    Thank you in advance,
    R.E.

    #2
    Hello R.E.,

    Stochastics are normally requested in the following format:
    Code:
    double Stochastics(int periodD, int periodK, int smooth).D[barsAgo];
    double Stochastics(int periodD, int periodK, int smooth).K[barsAgo];
    So for example in your code it might look like:
    Code:
    double D = Stochastics(7, 14, 3).D[0];
    double K = Stochastics(7, 14, 3).K[0];
    If the values you see on the chart do not match the values you see in your print it is likely that you are not using the same parameters between your stochastics indicators.

    Could you please provide a snippet of your code showing how you are requesting the stochastics indicator values as well as the PeriodD, PeriodK, and Smooth values you have applied to the Stochastic indicator on your chart?

    Thank you in advance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Hi,
      Thank you for your answer but the problem is deeper.
      I use Print all over the code, what I see got no sense to me:
      I call the initialize method three times. I don't know why?
      Second, I got a lot of issues with the stochastics and it is not related to the signature of the function: Even if I put false parameters how could the stochastics be equal to : -1,20508047984913E-12.
      My attempts to recreate the conditions of the bug in a simple strategy weren't successfull.

      Thank you for your help,
      R.E.

      Comment


        #4
        Originally posted by snoppss View Post
        Hi,
        Thank you for your answer but the problem is deeper.
        I use Print all over the code, what I see got no sense to me:
        I call the initialize method three times. I don't know why?
        Second, I got a lot of issues with the stochastics and it is not related to the signature of the function: Even if I put false parameters how could the stochastics be equal to : -1,20508047984913E-12.
        My attempts to recreate the conditions of the bug in a simple strategy weren't successfull.

        Thank you for your help,
        R.E.
        Why don't you provide a sample of your code as Michael suggested?

        By doing so, the brilliant Ninja staff will be best able to help you.

        Comment


          #5
          Hi,
          It is not my own code so I am not allowed to show the code. I want to do it but I do no have the choice. Anyway I am debugging the best I can and as I am calculating more than one time on a bar ( OnBarClose=false).
          To illustrate the issue here is a screenshot of what is happening: My stochastic found the good value but what is happening is that each time there is two other values making the strategy going crazy.

          Thank you in advance,
          R.E.
          Attached Files

          Comment


            #6
            Hello R.E.,

            I understand that you are unable to provide the code. Without seeing the code I can only guess at what is going on and that is not an efficient way to resolve the problem.

            For some basic tips to help you debug your code please see this forum post: http://ninjatrader.com/support/forum...ead.php?t=3418

            Based on your screenshot, my best guess is that you are using a multi-time frame or multi-instrument strategy and you are not filtering which Bars object is calling the Stochastics indicator properly.

            Normally you need to do a BarsInProgress check to make sure which series is calling OnBarUpdate. For example:
            Code:
            if(BarsInProgress == 0)
            {
            Print(Stochastics(7, 14, 3).K[0]);
            }
            For more information on working with multi-time frame and multi-instrument scripts, please see our help guide here: http://ninjatrader.com/support/helpG...nstruments.htm

            Please let me know if I may be of further assistance.
            Michael M.NinjaTrader Quality Assurance

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X