Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two instruments and Indicators for both of them

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

    Two instruments and Indicators for both of them

    How can I access indicators for both instruments? Should indicator be specified in Initialize method right after the instrument? What if indicators are the same, how can I define my variable as an indicator value referencing one of the instruments? Should chart window be opened automatically in case I have an indicator defined?
    Last edited by greed999; 08-10-2011, 12:25 PM.

    #2
    Hello,

    You can only add an indicaitor for the primary data series with NinjaScript.

    Let me know if I can be of further assistance.

    Comment


      #3
      Thank you, Brett, for your quick answer. However, can I hardcode first instrument in a script somehow? Or first instrument is to be defined during strategy startup?
      Last edited by greed999; 08-10-2011, 01:39 PM.

      Comment


        #4
        Always defined by the user in strategy startup.

        Comment


          #5
          What if i need a variable from indicator? Can the definition be done this way?

          tmp1=MyIndicator1(6,8,9).SpanLineA[0];
          tmp2=MyIndicator1(6,8,9).SpanLineB[0];

          Comment


            #6
            If you need a variable you would want to follow this sample on how to do this.



            Let me know if I can be of further assistance.

            Comment


              #7
              Is it appropriate to add
              if (Historical) return;
              into OnBarUpdate() for fast strategy start when indicators are being used?
              Last edited by greed999; 08-11-2011, 05:42 AM.

              Comment


                #8
                You can however if you will want to run test make sure it doesn't alter your indicator values. Some indicators/strategies need the historical data to run on. Would want to test it and compare the differences in your strat.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by arvidvanstaey, Today, 02:19 PM
                4 responses
                11 views
                0 likes
                Last Post arvidvanstaey  
                Started by samish18, 04-17-2024, 08:57 AM
                16 responses
                60 views
                0 likes
                Last Post samish18  
                Started by jordanq2, Today, 03:10 PM
                2 responses
                9 views
                0 likes
                Last Post jordanq2  
                Started by traderqz, Today, 12:06 AM
                10 responses
                18 views
                0 likes
                Last Post traderqz  
                Started by algospoke, 04-17-2024, 06:40 PM
                5 responses
                48 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X