Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Disable auto loop

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

    Disable auto loop

    Can I disable the auto loop so that I start from the oldest bar instead of the latest bar using a manual loop?

    Call it a learning disability, but I'm trying to adapt some of my VB.net code and I'm having a hard time thinking "backwards in time".

    Thanks,

    Paul

    #2
    Not sure I follow...What is an auto loop?
    RayNinjaTrader Customer Service

    Comment


      #3
      implied loop in ninja script

      In Ninja script you don't have to explicitly include a "for loop", you just enter what you want to calculate, indexed from the most recent bar. For example, if is want to calulate the different between todays close versus yesterdays close I would include the following line in the body of the code.

      Close(0) - Close(1)

      There is an implied loop already written into the script. What I want is to disable this part so I can do my calculation starting from the oldest bar. Like this

      Code:
       
      for (i=0; i < #ofbars; i++)
      {
      Close(i) - Close(i-1)
      }
      Thanks

      Comment


        #4
        Try something like this:

        Code:
        for (int index = Count -1; index >= 0; index--) 
        {
        Print(Close[index]);
        }
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pilotfo, Today, 12:50 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by DTSSTS, Today, 11:35 AM
        2 responses
        11 views
        0 likes
        Last Post DTSSTS
        by DTSSTS
         
        Started by sinpeople, Today, 07:20 AM
        2 responses
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Frank1000, Today, 03:05 AM
        5 responses
        16 views
        0 likes
        Last Post Frank1000  
        Started by fscabrera03, Yesterday, 01:18 PM
        2 responses
        26 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X