Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

3rd Party Indicator compile error

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

    3rd Party Indicator compile error

    I have a strategy where I am using two time periods
    The following is example of indicator in strategy where it is proper syntax
    _ADXVMA_v01_5_2(5, true).Signal[1] == 1

    The second time period also is using the same indicator but we need to index into second time period
    _ADXVMA_v01_5_2(5, true).Signal[1][1] == 1

    But I get compile error CS1995 and CS0021 error

    I have tried BarsArray _ADXVMA_v01_5_2(5, true).Signal[BarsArray[1][1]] == 1
    I have tried Closes[1][0]
    _ADXVMA_v01_5_2(5, true).Signal[Closes[1][1] == 1
    Any ideas?

    #2
    Hello bbucha_stk,

    BarsArray[1] and Closes[1] only work within the strategy it's called from - The series need to be added in that strategies Initialize() method to use.

    You can set a plot on the strategies secondary series. This plot is then available from other indicators / strategies.

    If it's not convenient to set a plot on this value, you can use principles from this sample to expose it:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan M
      Here is a snipet of code I don't think I was clear with the compile issue???
      I have my strategy running at 4 Range chart
      I am charting the ADX and MACD off the 4 range
      The issue is a compile on the if statement for the ADX for the 610 tick range time interval

      protectedoverridevoid Initialize()
      {
      Add(PeriodType.Tick, 610);
      //Add Indicators
      Add(_ADXVMA_v01_5_2(5, true));
      Add(MACD(
      4, 14, 9));
      }
      protectedoverridevoid OnBarUpdate()
      {

      if (BarsInProgress == 1)
      return;

      if ( WMA(BarsArray[1], 9)[0] >SMA(BarsArray[1], 55)[0]
      && _ADXVMA_v01_5_2(5, true).Signal[1][1] == 1

      && _ADXVMA_v01_5_2(5, true).Signal[1] == 1
      && CrossAbove(MACD(4, 14, 9).Diff, 0, 3))
      {;}

      Comment


        #4
        I see - thanks for the clarification.

        Your indicator has no input for a data series.
        _ADXVMA_v01_5_2(5, true).Signal[1]

        It's hard to tell what the syntax should be without seeing this. If you can paste the code or share the indicator file I can take a look. If you want to see the available overloads for your indicator, type:
        _ADXVMA_v01_5_2(

        You can then cycle through available overloads with up / down arrows. You're looking for one that offers IDataSeries as input. That's where you would place Closes[1] or BarsArray[1].
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Never mind I found my answer in the constructor for the ADX
          && _ADXVMA_v01_5_2(BarsArray[1],5, true).Signal[1] == 1

          Thankyou for your time on this

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mongo, Today, 11:05 AM
          4 responses
          14 views
          0 likes
          Last Post Mongo
          by Mongo
           
          Started by traderqz, Today, 12:06 AM
          7 responses
          14 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Skifree, Today, 03:41 AM
          5 responses
          13 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by traderqz, Yesterday, 09:06 AM
          5 responses
          35 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by guillembm, Today, 11:25 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X