• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Testing the "Load data based on" property in the DataSeries

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

    Testing the "Load data based on" property in the DataSeries

    Hello:

    I'm asking this question on the Forum as directed by NT TS as this is one of those undocumented/unsupported items that they understandably avoid.

    There are 3 possible choices for the "Load data based on" property in the DataSeries panel; Days, Bars, CustomRange.

    The code:
    Print("Type: " + Bars.BarsData.RangeType ");

    returns
    Type: Days (or whatever it is set to) which is correct according to the setting.

    and appears that it is a string. There are no blanks on either side of the response.

    It seems like a simple string comparison (String.Equals or String.Compare) could be used to compare the response to a string variable. I have not been able to find the correct string compare method or syntax to get the test to work;

    I need to be able to test if it is set to "Days" and if not do something different.

    I've tried countless variations but have yet to find the correct one. They compile fine but the return has always been a false condition. I've been using the simplist method which compares 2 strings and returns a Boolean result.

    Has anyone tried this before and gotten it to work and either is willing to share or work up the code?

    With appreciation:

    Frank

    #2
    Hello Frank,

    Thank you for your note.

    When I put the following in an indicator and apply it to a daily chart it correctly prints,

    Code:
    if(Bars.BarsData.RangeType.ToString()=="Days")
    	Print("Its a daily");
    Does this work for you?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan:

      Worked perfectly.

      As one of the TS people pointed out in an email to me prior to your post, the Type is an enum which because it is in a drop down I probably should have been able to figure out if I thought about it enough(lesson learned).

      I know how to test for a specific enum in a case statement but not in an if statement, which is probably doable. I tried replacing what would be the "case" statement syntax with an "if" but that didn't compile. I didn't work too hard finding out how to do it seeing that you have given me a workable solution.

      It would be nice to know to test the value of an enum using an ":if".

      Anyway, thank you for your assistance.
      Last edited by Cheech; 08-02-2018, 11:27 AM.

      Comment


        #4
        Hello Cheech,

        I've attached a NT8 sample which does this.

        See line 716.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NT-Roland, Today, 04:36 PM
        0 responses
        2 views
        0 likes
        Last Post NT-Roland  
        Started by Newtrader101, Today, 03:40 PM
        2 responses
        10 views
        0 likes
        Last Post Newtrader101  
        Started by Branpo, Today, 02:58 PM
        2 responses
        7 views
        0 likes
        Last Post Branpo
        by Branpo
         
        Started by sdauteuil, Today, 02:09 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by AMATX, Today, 02:19 PM
        2 responses
        11 views
        0 likes
        Last Post AMATX
        by AMATX
         
        Working...
        X