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!
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
NinjaTrader
Testing the "Load data based on" property in the DataSeries
Collapse
X
-
Hello Cheech,
I've attached a NT8 sample which does this.
See line 716.
Please let us know if you need further assistance.
-
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:
-
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");
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:
FrankTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by r68cervera, Today, 05:29 AM
|
0 responses
2 views
0 likes
|
Last Post
by r68cervera
Today, 05:29 AM
|
||
Started by geddyisodin, Today, 05:20 AM
|
0 responses
3 views
0 likes
|
Last Post
by geddyisodin
Today, 05:20 AM
|
||
Started by JonesJoker, 04-22-2024, 12:23 PM
|
6 responses
34 views
0 likes
|
Last Post
by JonesJoker
Today, 05:14 AM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
12 responses
3,239 views
0 likes
|
Last Post
by Leafcutter
Today, 05:08 AM
|
||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
0 responses
6 views
0 likes
|
Last Post
by AveryFlynn
Today, 04:57 AM
|
Leave a comment: