Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

merge 2 variables using Bars.GetClose

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

    merge 2 variables using Bars.GetClose

    Hello,

    Is it possible to merge the result of 2 variables without using a List?

    For example, closePrice = Bars.GetClose(barIndex); from a first loop and than add to closePrice the result of the second loop closePrice2 = Bars.GetClose(barIndex); ?

    Probably more a C# question.

    TY

    #2
    Hello frankduc,

    Are you asking to merge or add the two values together? value1 + value2?

    I am otherwise not certain what you mean by merge based on the given details.


    Please let me know if I may be of additional assistance.

    Comment


      #3
      Hello, Jesse,

      I meant add, like i created 2 lists var listp = new List<double>();
      var listcp = new List<double>();

      Than i add one to the other listcp.AddRange(listp);

      I was just wondering if there was a way with NT to do it without List.

      TY

      Comment


        #4
        Hello frankduc,

        I am not sure what you mean "if there is a way with NT to do it without a list", do what specifically?

        Are you asking if there is a way in NinjaTrader to store data such as a Plot or Series?

        From the details in your first post it seems like you want to add two doubles together, the GetClose method returns a double number.

        Please let me know if I may be of additional assistance.

        Comment


          #5
          Jesse,

          The idea is to join result from closePrice = Bars.GetClose(barIndex) to closePrice2 = Bars.GetClose(barIndex)
          Like 1,2,3 join to 4,5,6 to get 1,2,3,4,5,6,

          So i used var listp = new List<double>(); for closePrice and var listcp = new List<double>(); for closePrice2

          Join them using : listcp.AddRange(listp); and get my 1,2,3,4,5,6

          Thats why i was asking if there is a more easy way to join just the variables closePrice and closePrice2 without a List.

          ty

          Comment


            #6
            Hello frankduc,

            What you described is a function of the List<T> in C#, that's not something which would be in NinjaScript. If you need to join two lists of data that would be the way to do it.

            Please let me know if I may be of additional assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            607 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            353 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X