Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Last value

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

    #16
    Thanks for the help, but it's not what I'm looking for.
    I need the final result given by the last bar to get the variable, in this case of DCM 1.06 and then subtract to the array containing the months. Mean1= 1.06.
    And I don't need real time only the 12 months of the year to get the annual volatility.
    I will look into AI.​

    Comment


      #17
      Hello Gibranes,

      There is no last bar in real-time.

      Do you mean the last historical bar?

      The last historical bar is CurrentBar == Count - 2 when State is State.Historical.

      What do you mean by last bar?

      Do you mean the CurrentBar that is updating OnBarUpdate()?

      To confirm, you no longer want to "subtract it from the high value of the bar and to paint it in red under the bar."?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        I do not work with real time.
        Now I see it more clearly, I must obtain the value that is painted in the last bar December 2023 in monthly.
        Last bar being updated in OnBarUpdate().
        And then subtract it from the previous bars, although I didn't need to paint the bars. Subsequently, I need to get the variance and standard deviation, but I need to capture the December bar value first.
        I will continue tomorrow.
        Click image for larger version

Name:	NinjaV.png
Views:	52
Size:	55.9 KB
ID:	1319445

        Comment


          #19
          ​Ok. I want to get the last data of the December bar in monthly which is media1=1.06.

          for (int i = 0; i < ContadorVL; i++)
          {
          media1=SumaRendimientoAnual/ContadorVL;
          retornosDiarios[i]= media1=SumaRendimientoAnual/ContadorVL;
          }​


          What would be the best way.
          It is not real time data, only historical data.
          Should I instantiate in State.DataLoaded, better?​

          Comment


            #20
            Hello Gibranes,

            Are you wanting the last element of the retornosDiarios collection?

            Print(retornosDiarios[0]);

            or

            Print(retornosDiarios[retornosDiarios.Count() - 1]);​

            Depending on the type of collection.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            557 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X