Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 r68cervera, Today, 05:29 AM
0 responses
2 views
0 likes
Last Post r68cervera  
Started by geddyisodin, Today, 05:20 AM
0 responses
3 views
0 likes
Last Post geddyisodin  
Started by JonesJoker, 04-22-2024, 12:23 PM
6 responses
34 views
0 likes
Last Post JonesJoker  
Started by GussJ, 03-04-2020, 03:11 PM
12 responses
3,239 views
0 likes
Last Post Leafcutter  
Started by AveryFlynn, Today, 04:57 AM
0 responses
6 views
0 likes
Last Post AveryFlynn  
Working...
X