Announcement

Collapse
No announcement yet.

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.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      44 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      65 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X