Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Methods and Multiple Time Frame

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

    Custom Methods and Multiple Time Frame

    When using an included indicator such as EMA its possible to access to additional bar objects with the index [0] value.

    When using custom methods that are located in the UserDefinedMethods file how can i control what bar object they are working off? Should i just include the method within the file and rewrite it accordingly? Or is there a way to index it directly?

    Thanks!

    Ben

    #2
    neb1998, "bars" objects are only really recognized inside OnBarUpdate(), so you could create your methods in the user methods file and pass in the appropriate information via the arguments of the method inside OnBarUpdate().

    In pseudocode:
    Code:
    // this is the userdefinedmethods file
    private bool isHighGreaterThanLow(double high, double low)
    // could also pass in the data series directly - someMethod(DataSeries ds1, DataSeries ds2)
    {
       // do some stuff here
       return true;
    }
    
    // in strat/indicator
    OnBarUpdate()
    {
       bool check1 = isHighGreaterThanLow(High[1], Low[2]);
    }
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks, that is what i am doing now. I am also finding that in order to simulate Look Inside Bar=1minute that you must keep all calculations inside of (onbarupdate) method and not inside of the barsinprogress methods or it will not update the calculations correctly. I am just using indexing to the correct barsarray object, such as highs[1][0] to reference my 2nd data time, etc.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      368 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      571 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X