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

What is Input ?

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

    #31
    SMA Math functions were removed in NT8, and we also added some caching techniques to improve performance in many indicators.

    Code:
    NT8 - @SMA
    protected override void OnBarUpdate()
    {			
    	if (IsFirstTickOfBar)
    		priorSum = sum;
    
    	sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
    	Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
    }
    MatthewNinjaTrader Product Management

    Comment


      #32
      Originally posted by koganam View Post
      That is an if...else block, with a null else branch. Same thing.
      What is MSIL??? My guess is that's the main reason of using variables like NinjaTurtle & Snail, right?

      Sorry for my ignorance, I'm coming from the "native" world

      Comment


        #33
        Originally posted by NinjaTrader_Matthew View Post
        SMA Math functions were removed in NT8, and we also added some caching techniques to improve performance in many indicators.

        Code:
        NT8 - @SMA
        protected override void OnBarUpdate()
        {			
        	if (IsFirstTickOfBar)
        		priorSum = sum;
        
        	sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
        	Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
        }

        Thanks! Well, If you guys had given me a beta access as an EX, current or future developer, I would be able to take a peek by myself.

        Comment


          #34
          Originally posted by BankRobber View Post
          NOT bad, how about you stop checking is it BAR 0 on every single bar.

          And how about you kick out ALL of the math. min?
          The most important thing would be to improve the code for the case that CalculateOnBarClose is set to "False". The code below makes the SMA faster, but the output values are still the same as the original code that comes with NinjaTrader. If you are bored, you can probably take every single NinjaTrader indicator and make it lean and faster. Go ahead and enjoy yourself.

          Code:
          if(CurrentBar >= period)
          {    
               if(FirstTickOfBar)
                   last = Value[1] * period - Input[period];
               Value.Set((last + Input[0])/period);
          }    
          else if (CurrentBar > 0)
          {    
               if(FirstTickOfBar)
                   last= Value[1] * CurrentBar;
               Value.Set((last + Input[0])/(CurrentBar + 1));
          }    
          else    
               Value.Set(Input[0]);

          Comment


            #35
            Originally posted by BankRobber View Post
            What is MSIL??? My guess is that's the main reason of using variables like NinjaTurtle & Snail, right?

            Sorry for my ignorance, I'm coming from the "native" world
            ref: https://en.wikipedia.org/wiki/Common...diate_Language

            Do not apologize for seeking to know! We all started somewhere.

            Comment


              #36
              Originally posted by koganam View Post
              ref: https://en.wikipedia.org/wiki/Common...diate_Language

              Do not apologize for seeking to know! We all started somewhere.
              If you did't realize I was being sarcastic. I'm an old school guy, and I started 30 years ago in the world of machine coding. I just simply DON'T want to know anything about MSIL, because C# doesn't produce NATIVE code.
              C# & NET is the main reason, why NinjaTrader is soooo SLOOOOW.
              If you don't believe me, do your own tests. I've done mine long time ago.
              NinjaTrader 8 is in development for more than 3 years. What do you think why?
              What do i expect from Ninja 8? Absolutely nothing. Just more lipstick added to a old & tired snail. Unless of course they've spent these 3 years in rewriting 90% of NinjaTrader into native code, nothing will change. As a lifetime licence holder, I'm very disappointed.

              Comment


                #37
                Originally posted by BankRobber View Post
                If you did't realize I was being sarcastic. I'm an old school guy, and I started 30 years ago in the world of machine coding. I just simply DON'T want to know anything about MSIL, because C# doesn't produce NATIVE code.
                C# & NET is the main reason, why NinjaTrader is soooo SLOOOOW.
                If you don't believe me, do your own tests. I've done mine long time ago.
                NinjaTrader 8 is in development for more than 3 years. What do you think why?
                What do i expect from Ninja 8? Absolutely nothing. Just more lipstick added to a old & tired snail. Unless of course they've spent these 3 years in rewriting 90% of NinjaTrader into native code, nothing will change. As a lifetime licence holder, I'm very disappointed.
                No, I did not realize that you were being sarcastic, but let us not go down the "Who is the most ancient? route please. I do not wish to relive the nightmares of 40 years ago, dropping a stack of FORTRAN punch cards that I have not yet numbered, making it easier to simply punch over the whole thing, then waiting overnight for a tome of errors from a computer that had less than 1MB of memory, and occupied one whole floor of the lab. Heck my cellphone is way more powerful than that today, and has more storage.

                Later coding in Assembler in the halcyon days of the weak, first PC's, was not much fun either, when seen in hindsight, even if I had more complete control over the hardware.

                Do I hate managed frameworks? Yes, they are resource hogs that run too slowly. That is why I refused to even learn Java.

                However, I need to live in the current world, and have no desire to write a trading application from scratch. Railing against the machine pays no dividends. I made a choice, and I will just live with it until something better comes along.

                I never recommend anything other than NT, but there are trading applications written in C and C++. I tried quite a number of them. To me, they were deficient compared to NT. Having to use C# is, for me, a small price to pay to use what I consider to be an all-round superior application.

                As always, your milage may vary.

                Just my $0.02.
                Last edited by koganam; 08-26-2015, 04:40 PM.

                Comment


                  #38
                  Originally posted by koganam View Post
                  >dropping a stack of FORTRAN punch cards that I have not yet numbered, making it easier to simply punch over the whole thing,...
                  Just my $0.02.
                  I know exactly how it felt, except mine was in COBOL I bet my stack was bigger than yours.

                  Comment


                    #39
                    Originally posted by nkhoi View Post
                    I know exactly how it felt, except mine was in COBOL I bet my stack was bigger than yours.
                    Given the well-known verbosity of COBOL, I will not dispute your assertion.

                    Comment


                      #40
                      Originally posted by nkhoi View Post
                      I know exactly how it felt, except mine was in COBOL I bet my stack was bigger than yours.
                      That was the beauty of APL, you could fit that entire program on one card.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      168 responses
                      2,262 views
                      0 likes
                      Last Post sidlercom80  
                      Started by Barry Milan, Yesterday, 10:35 PM
                      3 responses
                      10 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by WeyldFalcon, 12-10-2020, 06:48 PM
                      14 responses
                      1,429 views
                      0 likes
                      Last Post Handclap0241  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by jeronymite, 04-12-2024, 04:26 PM
                      3 responses
                      41 views
                      0 likes
                      Last Post jeronymite  
                      Working...
                      X