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);
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
What is Input ?
Collapse
X
-
SMA Math functions were removed in NT8, and we also added some caching techniques to improve performance in many indicators.
Code:MatthewNinjaTrader Product Management
-
-
Originally posted by NinjaTrader_Matthew View PostSMA 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
-
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.Originally posted by BankRobber View PostNOT 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?
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
-
ref: https://en.wikipedia.org/wiki/Common...diate_LanguageOriginally posted by BankRobber View PostWhat 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
Do not apologize for seeking to know!
We all started somewhere.
Comment
-
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.Originally posted by koganam View Postref: https://en.wikipedia.org/wiki/Common...diate_Language
Do not apologize for seeking to know!
We all started somewhere.
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
-
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.Originally posted by BankRobber View PostIf 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.
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
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
576 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment