Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Performance of indicator with flexible input

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

    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, 09:54 AM.

    #2
    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.

    Comment


      #3
      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-04-2007, 11:37 PM.

      Comment


        #4
        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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Anthony_0709, Today, 01:29 PM
        2 responses
        6 views
        0 likes
        Last Post Anthony_0709  
        Started by kenbun, Today, 12:21 PM
        0 responses
        9 views
        0 likes
        Last Post kenbun
        by kenbun
         
        Started by WNorton, Today, 11:23 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Spencer  
        Started by stafe, Today, 10:43 AM
        0 responses
        12 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by UltraNIX, Today, 09:13 AM
        3 responses
        18 views
        0 likes
        Last Post UltraNIX  
        Working...
        X