Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with KAMA difference indicator

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

    Problem with KAMA difference indicator

    Dear support and forum members,

    I was searching for an answer to my problem, but couldn't find one on the forum or internet. Hoping it will not sound to ridiculous to you, here is what I am trying to solve:

    I would like to construct an indicator that plots the difference between KAMA[0] and KAMA[n], n days ago; for simplicity I assume n=3. First I coded in OnBarUpdate():

    Code:
    Plot0.Set(KAMA(Close,2,10,30)[0]);
    to just display the KAMA[0] value in a seperate plot which worked out perfectly on a newly opened chart. I then close the chart changed the code to:

    Code:
    Plot0.Set(KAMA(Close,2,10,30)[0]-KAMA(Close,2,10,30)[3]);
    Saved, recompiled, opened a new chart, but nothing showed up in the seperate plot anymore, just the scale from 0 to 1. When I opened the data window no values were displayed for Plot1.

    Can somebody help me out with this?

    Thank you in advance, kindest regards,

    nescio

    #2
    Welcome to the support forums at NinjaTrader - please check this tip here -> http://www.ninjatrader-support2.com/...ead.php?t=3170 Most likely you run into this...

    Comment


      #3
      Thanks for your really quick answer. I helped, but now my indicator looks weired as you can see in the screenshot. Any idea?

      I changed the code to:
      Code:
                  if (CurrentBar < 3) 
                  {
                      return;
                  }
                  if (Close[0] > Close[1]) 
                  {
                      Plot0.Set(KAMA(Close,2,10,30)[0]-KAMA(Close,2,10,30)[3]);
                  }
      Attached Files

      Comment


        #4
        Found the problem myself. Used the wrong if clause from copy and pasting from the code you provided. Thank you for your quick support!

        Comment


          #5
          You're welcome, great you got it resolved!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          43 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          25 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          163 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          98 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          158 views
          2 likes
          Last Post CaptainJack  
          Working...
          X