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 creating indicator

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

    Problem creating indicator

    I'm trying to create a Momentum dots indicator but have never done this before. Would appreciate if someone could take a look and see where I went wrong.

    The formula is ((High[2]+Low[2]+Close[2])/3 + (High[4]+Low[4]+Close[4])/3 + (High[3]+Low[3]+Close[3])/3)/3;

    Thanks,

    Mpe
    Attached Files

    #2
    How about:

    Mom.Set(((High[2]+Low[2]+Close[2])/3 + (High[4]+Low[4]+Close[4])/3 + (High[3]+Low[3]+Close[3])/3)/3);
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Originally posted by eDanny View Post
      How about:

      Mom.Set(((High[2]+Low[2]+Close[2])/3 + (High[4]+Low[4]+Close[4])/3 + (High[3]+Low[3]+Close[3])/3)/3);
      Thanks for the reply. Now it compiles without errors but it doesn't plot on my charts. I guess there's still something wrong.

      Mpe

      Comment


        #4
        Check your Log tab on your Control Center for some yellow highlighted error.
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          mpe66,

          add the CurrentBar line where shown.


          protected override void OnBarUpdate()

          {

          if (CurrentBar < 5) return;



          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #6
            That would be it RJay, I can see in the picture it needs that. Dan
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Originally posted by mpe66 View Post
              Thanks for the reply. Now it compiles without errors but it doesn't plot on my charts. I guess there's still something wrong.

              Mpe
              eDanny and RJay have the right answer for you mpe66. Basically you just need to make sure there are enough bars loaded on your chart before running calculations. On the very first bar of a chart (left-most bar), for example, it wouldn't make sense to access the High of the 3rd bar back because it doesn't exist. Here is a link to a post by Ray that further describes what is happening.
              AustinNinjaTrader Customer Service

              Comment


                #8
                Thanks a lot guys. That solved it.

                Mpe

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by pmachiraju, 11-01-2023, 04:46 AM
                8 responses
                148 views
                0 likes
                Last Post rehmans
                by rehmans
                 
                Started by mattbsea, Today, 05:44 PM
                0 responses
                5 views
                0 likes
                Last Post mattbsea  
                Started by RideMe, 04-07-2024, 04:54 PM
                6 responses
                33 views
                0 likes
                Last Post RideMe
                by RideMe
                 
                Started by tkaboris, Today, 05:13 PM
                0 responses
                5 views
                0 likes
                Last Post tkaboris  
                Started by GussJ, 03-04-2020, 03:11 PM
                16 responses
                3,282 views
                0 likes
                Last Post Leafcutter  
                Working...
                X