Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not recieving multiple indicator outputs

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

    Strategy not recieving multiple indicator outputs

    Hi,

    Likely a very easy question: an indicator I've written sets Values[t].Set(HistogramArea) in a loop where t = 1, 2, 3.

    The indicator outputs are between 0 and 1, and there are three series.This graphs correctly in the indicator. Three series, each graphing between 0 and 1.

    When running a strategy I Add(IndicatorName()); and then reference the values with IndicatorName().Values[1].Count (which returns what appears to be a correct large number of bars)

    Print (IndicatorName().Values[1][0]); returns zero.
    Print (Print (IndicatorName().Values[1][IndicatorName().Count - 1]); returns nine hundred and something.

    1) Should the indicator values be referenced with an ibarsago parameter?

    2) Where are my correct values outputs for series IndicatorName.Values[1][0], for example?

    Thanks.
    BD

    #2
    bigdavediode,

    1) Should the indicator values be referenced with an ibarsago parameter?

    BarsAgo is just an integer. BarsAgo = 0 means the "Curent bar".

    2) Where are my correct values outputs for series IndicatorName.Values[1][0], for example?

    I am not sure here. Values is a collection holding DataSeries objects that hold the indicator's underlying calculated values. Likely I'll need to see more of your code.

    Values[0][ Values[0].Count - 1] would return the first bar on your chart into the past.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      "BarsAgo is just an integer. BarsAgo = 0 means the "Curent bar"."

      Yes, thanks. I'm just wondering if the Values parameter requires a barsago parameter versus an absolute bar count parameter.

      "I am not sure here. Values is a collection holding DataSeries objects that hold the indicator's underlying calculated values.

      What is the method you recommend for referencing an indicator's values from a strategy, in the event of an indicator outputting multiple values? Is there example code for this?

      "Values[0][ Values[0].Count - 1] would return the first bar on your chart into the past."

      So Values requires an absolute bar count as parameter, versus barsago?

      Thanks for your help.

      Comment


        #4
        bigdavediode,

        The way dataseries work is that they start with nothing in them. The indicator begins on the first bar on your chart after "BarsRequired" has been satisfied and builds the DataSeries up. For every bar, the BarsAgo = 0 index means "The most current bar" hence the name. BarsAgo = 5 means "5 bars ago" for the indexing.

        myDataSeries.Set(value); adds another element to the data structure for the most recent "bar".

        DataSeries is sort of like a stack with indexing where a 0 index is always the most current calculation or stored value. Each bar that the indicator iterates through throws the most recent calculation/value on the top of the "stack". It does not work exactly like an array. Note also the DataSeries data structure itself is not actually a stack, so I was just using that terminology to help explain.

        Values is the default dataseries for plots. These are accessible from a strategy by using :

        MyIndicator.Values[x][y]; //for an actual value from the dataseries
        MyIndicator.Values[x]; //for a specific dataseries object which is one of your indicator plots
        MyIndicator.Values; //for the "array" of dataseries

        We have many reference samples here : http://www.ninjatrader.com/support/f...splay.php?f=30
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          "BarsAgo is just an integer. BarsAgo = 0 means the "Curent bar"."

          Yes, thanks. I'm just wondering if the Values parameter requires a barsago parameter versus an absolute bar count parameter.

          "I am not sure here. Values is a collection holding DataSeries objects that hold the indicator's underlying calculated values.

          What is the method you recommend for referencing an indicator's values from a strategy, in the event of an indicator outputting multiple values? Is there example code for this?

          "Values[0][ Values[0].Count - 1] would return the first bar on your chart into the past."

          So Values requires an absolute bar count as parameter, versus barsago?

          Thanks for your help.

          Comment


            #6
            Hi Adam,

            It appears that the ibarsago parameter was supplied correctly, however the indicator behind the strategy had crashed, producing zeros.

            For the next version it may be beneficial to have separate output windows for the strategy and one for each indicator referenced, and error messages propagating to each appropriately.

            Thanks for your help.

            Comment


              #7
              Thanks for letting us know Dave - I have added your request for separate strategy / indicator output windows for easier debugging to our list of feedback for future consideration.

              For accessing multiple outputs from an indicator you would either refer to either plot the indicator would populate, those would be exposed for access per se, or you would custom expose the needed series -

              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DJ888, 04-16-2024, 06:09 PM
              4 responses
              12 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by terofs, Today, 04:18 PM
              0 responses
              7 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              6 views
              0 likes
              Last Post nandhumca  
              Started by The_Sec, Today, 03:37 PM
              0 responses
              3 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Started by GwFutures1988, Today, 02:48 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X