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

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by PhillT, Today, 02:16 PM
            2 responses
            3 views
            0 likes
            Last Post PhillT
            by PhillT
             
            Started by Kaledus, Today, 01:29 PM
            3 responses
            9 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by frankthearm, Yesterday, 09:08 AM
            14 responses
            47 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by gentlebenthebear, Today, 01:30 AM
            2 responses
            14 views
            0 likes
            Last Post gentlebenthebear  
            Started by PaulMohn, Today, 12:36 PM
            2 responses
            17 views
            0 likes
            Last Post PaulMohn  
            Working...
            X