Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing the currently used Instrument and Time frame

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

    Accessing the currently used Instrument and Time frame

    Hello,

    I know that this probably have been answered before, but I searched a lot and I didn't find any answers. So here's my question:

    When testing a strategy withing Strategy Analyzer, we first click on the desired instrument and then we'll set the time frame and then run the test. How can I access the name of instrument and the time frame that I'm currently testing from within my script?
    Last edited by arian_gh; 02-19-2015, 09:12 AM.

    #2
    Hello,

    Thank you for the question.

    While this is technically not supported here are the answers.

    For the Name you would need to get the full name from the instrument or the following:

    Code:
    Instrument.FullName
    There is also Instrument.Name but this does not get the contract for a futures so FullName will get the contract as well.


    For the chart type and time frame you can access the Bars information by doing the following:

    Code:
    Print(Bars.BarsType.Period.Value.ToString() + " " + Bars.BarsType.PeriodType.ToString());
    This would print 1 minute on a 1 minute chart.

    The period type can be used as such as well:

    Code:
    if(Bars.BarsType.PeriodType == PeriodType.Day) 
    {
    	//do something if day bars	
    }
    Please let me know if I may be of additional assistance.

    Comment


      #3
      Thank you so much for your help Jesse. Your reply fully answered my question.

      Comment

      Latest Posts

      Collapse

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