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

Stochastics Indicator value incorrect

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

    Stochastics Indicator value incorrect

    Just getting starting with NT and have searched with no luck. I'm writing a strategy that adds a Stochastics indicator to a 5 Minute Chart. The chart and indicator are updating OnEachTick. I'm having an issue where the value shown on the chart does not align with what I'm getting my code. In the attached, I've included what VS shows me in Debug mode for the Values of K[0], D[0], K[1], D[1]. The values at the[1] index match what I see in the Chart/DataBox but the values at index [0] do not. The is 3 points higher. Any help is appreciated.
    Attached Files

    #2
    P.S. Went through the entire chart and indicator for the playback period (using Market Replay) and the K line never crosses 28 in NT so not sure where my code is getting 28.8888 from. Thanks again.

    Comment


      #3
      Hello donniea21,

      Thank you for the post.

      For this type of situation I would not suggest to use visual studio to try and observe values as they likely wont match what is being rounded to the Tick size in the user interface. Your code will see the whole value but the Plot will be rounded to the tick size for the instrument.

      A better way to do this comparison would be to just use a Print and round your value to the tick size: https://ninjatrader.com/support/help...ghtsub=roundto

      Another factor here would be if you manually applied the indicator and are comparing the code values to the manual indicator. That may actually be calculated differently if they have different data being used or different starting points. If you are instead using AddChartIndicator that would be the correct approach to visualizing what the strategy indicator is doing.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by adeelshahzad, Today, 03:54 AM
      4 responses
      22 views
      0 likes
      Last Post adeelshahzad  
      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
      15 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  
      Started by yertle, Today, 08:38 AM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X