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 DJ888, Today, 10:57 PM
          0 responses
          0 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X