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 Hwop38, 05-04-2026, 07:02 PM
          0 responses
          169 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          324 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          250 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          353 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          180 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X