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

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...
    BertrandNinjaTrader Customer Service

    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!
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jclose, Today, 09:37 PM
          0 responses
          5 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,413 views
          0 likes
          Last Post Traderontheroad  
          Started by firefoxforum12, Today, 08:53 PM
          0 responses
          11 views
          0 likes
          Last Post firefoxforum12  
          Started by stafe, Today, 08:34 PM
          0 responses
          11 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by sastrades, 01-31-2024, 10:19 PM
          11 responses
          169 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X