Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy or indicator. What should be done and where?

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

    Strategy or indicator. What should be done and where?

    Here is my basic setup:

    Indicator:
    draws several plots on chart,
    draws many other objects on chart,
    exposes a handful of parameters to strategy.

    Strategy:
    grabs all plot data and exposed params from indicator every OnBarUpdate(),
    draws a single plot to a strategyPlot as per your example,
    also does a fair amount of:
    DrawText(), Print(),
    BackColor = Color.AnyColor,

    I have read bits and pieces in several threads while looking for other things that lead me to believe that there are definite divisions of labor that optimize performance. What are they? There must be a doc or thread that addresses this specifically.

    I also read in some thread that the StrategyAnalyzer will not work with strategy that plots. My strategy appears to work with StrategyAnalyzer. How would I know if StrategyAnalyzer is not happy with my strategy?

    #2
    Hello bernie_c,

    For a Performance Consideration Document you may see our Help Guide at the following link.



    There you will see that the Log() and Print() method defiantly carry a heavy performance load so you may not want to use them unless they are needed.

    As for any other items concerning performance, they are more situational in this regards. For example, if you are drawing an object on every bar and load up your NinjaScript item on a daily chart, by default you are only drawing 365 objects (365 days is the default load period). If you change this and say load a 1 Minute on your NinjaScript item by default you are loading up a possible 7200 objects (1440 Minutes in a day and loading back 5 days worth of data) which is almost 20xs more than the amount of the first load.

    If your strategy is not running as you would like it you may want to take a look at how many Print() or Draw...() you are calling and try to reduce this to help.


    As for the Strategy Analyzer and Strategy Plots, this will not cause your Strategy to not work, but any values that you set to your Strategy Plot will not be accessible/Visible when ran inside of the Strategy Analyzer is all. There is a note on our example page that is as follows:

    This technique has limited functionality. It will NOT work for charts in the Strategy Analyzer during backtesting, but it will work on real-time charts.

    http://www.ninjatrader.com/support/f...ead.php?t=6651

    Basically, if you are using the Strategy Plot for visuals then they will not be visible on the chart when selecting the Chart tab but your strategy should work normally, but if you are using the Strategy Plot for calculations in your strategy they will not get the correct values.


    Please let me know if you have any further questions or if we can be of any further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      What about exposing parameters originating in the indicator to the strategy? The parameters in question need to be calculated in the indicator for plotting purposes. Is it better to expose them to the strategy or to recalculate them in the strategy?

      Comment


        #4
        Originally posted by bernie_c View Post
        What about exposing parameters originating in the indicator to the strategy? The parameters in question need to be calculated in the indicator for plotting purposes. Is it better to expose them to the strategy or to recalculate them in the strategy?
        I think in general you should try for maximum reuse ...

        Is it a core part of the indicator? Does it relate to the indicator?

        Will this information be useful in future strategies? If so, leave it in the indicator.

        Strategies should deal with more of the buying/selling logic.... If say 5 different indicators say something - then go Long..

        Comment


          #5
          Hello bernie_c,

          As sledge stated, if it can be done in the strategy and is not needed in other strategies - just add the code to the strategy. If not, call the indicator's method.

          In general, calling an indicator to process code should not be performance heavy. Although, factor in large calculations over large data sets and then it can become a performance issue. Or if you had to pass multiple bar series in your strategy through the indicator to and then compare those values.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X