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

Performance of indicator with flexible input

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

  • KBJ
    replied
    You're welcome, Rollins. Grab the enum and CalcMovingAverage() method out of the StochasticsWithSmoothing.cs file and I think you'll find it will help.

    Leave a comment:


  • Rollins
    replied
    Thanks for the suggestion and the code KBJ.

    The performance in the MAV 1.2 version with the indicator class is worse then the original one.

    Just setting the indicator on Initialize() was my first optimization idea, but it doesn't work, as seen in MAV_v1.1 and the quote I posted.

    Of course it might work with the right adjustments, but I don't know what they should be.

    What I am wondering about is how wasteful such an indicator really is, but that's something for the NT guys because it requires knowledge of how it's handled internally.

    MAV_1.0 works fine, if anyone wants to use it.

    Cheers
    Last edited by Rollins; 11-05-2007, 12:37 AM.

    Leave a comment:


  • KBJ
    replied
    That's a clever technique.

    But why not move the initialization of "indicator" to the Initialize() method?

    That's probably what's making it slow... it doesn't have to be done for every bar.

    By the way, there's a full list of these moving averages in this post: http://www.ninjatrader-support.com/v...ht=Stochastics

    I also based the selection of moving average types in StochasticsWithSmoothing on Gumphrie's enumeration example, and I've now updated it to use the Indicator class, like is in your code. I don't know why but somehow or other that refinement escaped me when I originally wrote this code, but I like this much better.

    You might want to steal the enum and CalcMovingAverage() method from that file, it might save you a little work. And it is well commented.

    Leave a comment:


  • Rollins
    started a topic Performance of indicator with flexible input

    Performance of indicator with flexible input

    Hi,

    I made my indicators a lot more flexible by writing a base indicator that I feed all the data and which knows by passing an int parameter which MA to apply.
    I got the idea when I looked at how Gumphrie used enums and with some trying I was able to come up with a nice use for them.

    Now what I' really love to know is, how much does this degrade performance/memory use being a deoptimzation. Possible ways to keep this in check.

    To get a bit of a performance increase I thought I'd try something else.
    You can see it in the MAV 1.1, it never throws and exception an never calls OnBarUpdate, so I get nada nothing zilch.

    04.11.2007 15:32:25|3|4|Failed to call method 'Initialize' for indicator 'MAxOver': Unable to cast object of type 'NinjaTrader.Indicator.DataSeriesHelper' to type 'NinjaTrader.Data.Bars'.
    04.11.2007 15:33:23|3|4|Error on calling the 'OnBarUpdate' method for indicator 'IndicatorX' on bar 0: Unable to cast object of type 'NinjaTrader.Data.DataSeries' to type 'NinjaTrader.Data.Bars'.
    Ok fixed that in the MAV 1.2 ... but dunno if it will improve performance that much.
    Actually the MAV 1.2 version is much worse, chart was stuck for a second after dragging.


    Thanks in advance and cheers,

    Rollins
    Attached Files
    Last edited by Rollins; 11-04-2007, 10:54 AM.

Latest Posts

Collapse

Topics Statistics Last Post
Started by zstheorist, Today, 07:52 PM
0 responses
3 views
0 likes
Last Post zstheorist  
Started by pmachiraju, 11-01-2023, 04:46 AM
8 responses
149 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  
Working...
X