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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X