Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

script to have indicators already on "chart" tab in strategy analyzer

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

    script to have indicators already on "chart" tab in strategy analyzer

    Sounded simple enough, but it's hard to search for "indicator and strategy and analyzer" in this forum.

    Is there any way to have certain indicators already on the "chart" tab in strategy analyzer once the backtest has been run? For example, if the strategy involves volume, a 5 min SMA and a 15 min SMA, one would probably want to see all of those things when reviewing the chart without having to add each one after the test has run.

    I know that it can be done with the drawing tools within the script, but this seems CPU intensive. I tried loading a template afterwards, but it removed all of my buy and sell points.

    Many thanks in advance.

    #2
    Hello,

    Thank you for your forum post.

    You can add these with your strategy. To do this use the Add() method in the Initilize() Method.

    Please see the following:



    Code:
    [FONT=Courier New][COLOR=#0000ff]protected override[/COLOR] [COLOR=#0000ff]void[/COLOR] Initialize()[/FONT] 
    [FONT=Courier New]{[/FONT] 
    [FONT=Courier New]    [COLOR=#008000]// Add a 5 minute Bars object - BarsInProgress index = 1[/COLOR][/FONT] 
    [FONT=Courier New]    Add(PeriodType.Minute, 5);[/FONT]
    [FONT=Courier New]    [COLOR=#008000]// Add a 100 tick Bars object for the ES 12-06 contract - BarsInProgress index = 2[/COLOR][/FONT] 
    [FONT=Courier New][COLOR=#008000]    [/COLOR]Add("ES 12-06", PeriodType.Tick, 100);[/FONT] 
    [COLOR=#008000][FONT=Courier New]                                     
        // Charts a 20 period simple moving average to the chart[/FONT][/COLOR] 
    [FONT=Courier New][COLOR=#008000]    [/COLOR]Add(SMA(20));  
    }[/FONT]

    Comment


      #3
      Thank you.

      I have successfully added the SMA this way, but can not figure out how to get volume in the chart. Everything that I have tried will not compile. I would like to see it just in zone 2 like an ordinary graph.

      Also, is there any way to use Add() for custom indicators?

      Thank you again,

      DK

      Comment


        #4
        Hello,

        You would use Add(VOL()); should do the trick.

        You would only be able to add this for strategies and you will get an error if you try to add it to an indicator.

        Let me know if I can be of further assistance.

        Comment


          #5
          Thanks Brett,

          Is there any way to pass on details such as where you would want a particular indicator? For example, with your help I was able to get volume on the chart as well as VolSMA(20). But volume is on panel 2 and VolSMA(20) is on panel 3. I would like it to be overlayed on panel 2.

          Similarly, I have a custom indicator that is supposed to be overlaid on price, but instead it is displayed in a panel below.

          Continuing to appreciate your help,
          D

          Comment


            #6
            Hello,

            You cannot predetermine what panel an indicator is going to reside on besides the price panel. If you want it on the price panel you will have to type in Overlay = true. Otherwise each new indicator will by default be added to a new panel.



            Let me know if I can be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by habeebft, Today, 07:27 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_ChristopherS  
            Started by AveryFlynn, Today, 04:57 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Max238, Today, 01:28 AM
            4 responses
            37 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by r68cervera, Today, 05:29 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by geddyisodin, Today, 05:20 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X