Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing variable from a 5min Indicator and 15min Indicator

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

    Accessing variable from a 5min Indicator and 15min Indicator

    Having Read the following link about accessing Indicator variables ina Strategy on the same chart



    I have an instance of my indicator('my_ind') in Market Analyzer on 5min chart(effectively) and an instance of the same indicator added again and set to 15min...

    What is the is the instance name on 5min chart and 15min chart?

    or does it have the same name and do I need to differentiate the variable names like the folowing in my sole indicator 'my_ind'

    my_ind().var5[0] == 0;
    my_ind().var15[0] == 0;

    where 'var5' and 'var 15' are set based on

    if ((Bars.Period.Id == PeriodType.Minute) && (Bars.Period.Value == 5) )
    {
    //set 'var5' here
    }


    ?

    #2
    The name would be the same. The way to differentiate them is to use the BarsArray.

    my_ind(BarsArray[1]).someValue

    versus

    my_ind(BarsArray[2]).someValue
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      so if the variable is say 'Trend' in the indicator 'my_ind' then to set to the following variable(sum) on 5min chart only would look like;

      if ((Bars.Period.Id == PeriodType.Minute) && (Bars.Period.Value == 5) )
      {
      Sum.set [0] = my_ind(BarsArray[0]).Trend[0] + my_ind(BarsArray[1]).Trend[0];
      //sum 5 and 15min Trend values on the 5min timeframe
      }

      Comment


        #4
        or I could write it as

        if ((Bars.Period.Id == PeriodType.Minute) && (Bars.Period.Value == 5) )
        {
        Sum.set [0] = Trend[0] + my_ind(BarsArray[1]).Trend[0];
        //sum 5 and 15min Trend values on the 5min timeframe
        }

        What happens when the indicator can not find 15min data or other time frame - say I put the indicator just on a 5min chart alone and not in the market analyzer as two instances(5min, 15min) do I have to do a check on BarsArray? HOw do I do that?

        Comment


          #5
          mefTrader,

          Not sure I follow what you mean. You can only access multi-time framed values from a NinjaScript Strategy. From a NinjaScript strategy you add the various time frames you want to use and then you just access the indicator based on the time frame you are looking for. This is achieved through BarsArray[]. Please see this article as it may help: http://www.ninjatrader-support.com/H...ameInstruments
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            So how do I access multiple instances of indicators in a Market Analyzer?

            my_ind is added as a instance and the minute =5
            my_ind is added again as another instance and the minute is set to 15

            Comment


              #7
              mefTrader, this is not possible for indicators in NinjaTrader 6.5 - only strategies have the option to work with multiple series / multiple timeframes in NinjaTrader 6.5



              For NinjaTrader 7 we extented this concept to indicators as well, as we then have MultiSeries charting capabilities.

              BertrandNinjaTrader Customer Service

              Comment


                #8
                ok what is the release date of NT7?

                Comment


                  #9
                  We're currently in beta and successfully working on resolving reported issues - a public beta should follow shortly - when this would be the case and all other related details can be found here -

                  BertrandNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by thanajo, 05-04-2021, 02:11 AM
                  4 responses
                  470 views
                  0 likes
                  Last Post tradingnasdaqprueba  
                  Started by aa731, Today, 02:54 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post aa731
                  by aa731
                   
                  Started by Christopher_R, Today, 12:29 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Christopher_R  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  166 responses
                  2,237 views
                  0 likes
                  Last Post sidlercom80  
                  Started by thread, Yesterday, 11:58 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post thread
                  by thread
                   
                  Working...
                  X