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 Christopher_R, Today, 12:29 AM
          0 responses
          6 views
          0 likes
          Last Post Christopher_R  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          166 responses
          2,235 views
          0 likes
          Last Post sidlercom80  
          Started by thread, Yesterday, 11:58 PM
          0 responses
          3 views
          0 likes
          Last Post thread
          by thread
           
          Started by jclose, Yesterday, 09:37 PM
          0 responses
          7 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,415 views
          0 likes
          Last Post Traderontheroad  
          Working...
          X