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

Cannot apply indexing with [] to an expression of type double

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

    Cannot apply indexing with [] to an expression of type double

    Hi,

    I'm trying to convert some NT7 codes to NT8 codes. Kindly pardon my limited knowledge in programming.

    I've these codes which i convert to NT8, but it returns with the error as per the heading. Any kind soul could advise what is the correct code structure I should use?

    NT7
    Somewhere down i have this:
    RT.Set(4, RLL);

    and further down the code, i have this:
    [XmlIgnore]
    [Browsable(false)]
    public DataSeries RT
    {
    get
    {
    return base.Values[0];
    }
    }

    NT8
    This is what i tried to change to:
    RT[0][4] = RLL;

    and further down the code, i have this:
    [XmlIgnore]
    [Browsable(false)]
    public Series<double> RT
    {
    get
    {
    return base.Values[0];
    }
    }

    Thanks!

    #2
    Hello Geck78,
    Thanks for your post and welcome to the NinjaTrader forum.

    I expect the issue is:
    Code:
    RT[0][4] = RLL;
    and that changing it to this will compile fine:
    Code:
    RT[0] = RLL;
    What do the two inputs mean for the the RT indicator in NT7?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      thanks for the reply.

      i believe that RT was DataSeries.Set(int barsAgo, double value), so i think the value of 4 should still appear somewhere??

      Also, sorry, i had actually changed in NT8 version the following:

      [XmlIgnore]
      [Browsable(false)]
      public Series<double> RT
      {
      get
      {
      return base.Values[0][0];
      }
      }

      Thanks!

      Comment


        #4
        Gecko78,

        If the barsAgo value is 4, you would use that instead of 0.
        Code:
        RT[4] = RLL;
        Not sure why you would want to do this, but I believe that's how it would be done. I suggest making this change and seeing if the results are the same as in NT7.

        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        23 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        22 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X