• 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

  • NinjaTrader_AlanP
    replied
    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

    Leave a comment:


  • Cheech
    replied
    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.

    Leave a comment:


  • NinjaTrader_AlanP
    replied
    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.

    Leave a comment:


  • 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

Latest Posts

Collapse

Topics Statistics Last Post
Started by brucerobinson, Today, 05:52 AM
2 responses
4 views
0 likes
Last Post brucerobinson  
Started by margandi, 10-09-2019, 03:01 AM
8 responses
24 views
0 likes
Last Post koganam
by koganam
 
Started by 2Look4me, Today, 08:50 AM
1 response
3 views
0 likes
Last Post NinjaTrader_Jim  
Started by marcara, 10-11-2019, 03:08 AM
4 responses
23 views
0 likes
Last Post NinjaTrader_ChristopherD  
Started by TheWhiteDragon, Today, 07:37 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Kate  
Working...
X