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
Determine input price type
Collapse
X
-
Hello digibob,
Thanks for your patience.
Here is something you can work with:
Code:if (CurrentBar == 0) { Print ("price Type is:"); if (Input[0] == Median[0]) Print ("Median"); else if (Input[0] == Typical[0]) Print ("Typical"); else if (Input[0] == Weighted[0]) Print ("Weighted"); else if (Input[0] == High[0]) Print ("High"); else if (Input[0] == Low[0]) Print ("Low"); else if (Input[0] == Open[0]) Print ("Open"); else Print ("Close"); }
I'm checking to see if there isn't a more elegant solution and if I find anything I will update this thread.
Paul H.NinjaTrader Customer Service
Comment
-
Hi Paul. Thanks for the suggestion. It would work as long as no two are the same. If the Close equals the High for example, it may fail.
I take it there's no built in property or method such as InputPriceType, .GetName, something like that.
Well, thanks anyway.
Comment
-
Originally posted by digibob View PostHi Paul. Thanks for the suggestion. It would work as long as no two are the same. If the Close equals the High for example, it may fail.
I take it there's no built in property or method such as InputPriceType, .GetName, something like that.
Well, thanks anyway.
- Likes 1
Comment
-
Thanks guys.
Removing the 'else' will not prevent a wrong call when two types are same value.
I added a custom 'price type' enum property that has to be set alongside the actual price type. It's not more elegant than Paul's suggestion but it works for now.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by agclub, 04-21-2024, 08:57 PM
|
5 responses
32 views
0 likes
|
Last Post
by agclub
Today, 09:47 PM
|
||
Started by ESHunter, Today, 08:06 PM
|
2 responses
16 views
0 likes
|
Last Post
by ESHunter
Today, 09:27 PM
|
||
Started by ETFVoyageur, 05-07-2024, 07:05 PM
|
19 responses
150 views
0 likes
|
Last Post
by ETFVoyageur
Today, 09:14 PM
|
||
Started by ETFVoyageur, Yesterday, 10:13 PM
|
3 responses
26 views
0 likes
|
Last Post
by ETFVoyageur
Today, 09:08 PM
|
||
Started by ETFVoyageur, Yesterday, 12:52 AM
|
3 responses
33 views
0 likes
|
Last Post
by ETFVoyageur
Today, 09:05 PM
|
Comment