Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Select indicator through [NinjaScriptProperty]
Collapse
X
-
Hello cstangor, and thank you for your question.
This is not directly possible. The attached script will demonstrate why. While it will compile correctly, if you type "SMA(14)" in as its input parameter, it will still fail. Even if NinjaTrader were modified so this succeeds we would still be in a difficult position, as the 14 hard-coded into OnBarUpdate was an arbitrary choice, and if typing SMA(14) were made to work, typing SMA(50) would also be made to work, and you as a coder do not have a view into this input.
The best option currently available is to take an integer, string, or similar supported input, and use a switch statement based on this input to set up an indicator based on the user's selection, i.e.
Code:[FONT=Courier New]switch inputvar { case 1 : myIndicator = MACD(1, 2, 3); case 2 : myIndicator = SMA(14); default : myIndicator = EMA(12); }[/FONT]
Attached FilesJessica P.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by 00nevest, Today, 02:27 PM
|
0 responses
1 view
0 likes
|
Last Post
by 00nevest
Today, 02:27 PM
|
||
Started by Jonafare, 12-06-2012, 03:48 PM
|
5 responses
3,986 views
0 likes
|
Last Post
by rene69851
Today, 01:44 PM
|
||
Started by Fitspressorest, Today, 01:38 PM
|
0 responses
2 views
0 likes
|
Last Post Today, 01:38 PM | ||
Started by Jonker, Today, 01:19 PM
|
0 responses
2 views
0 likes
|
Last Post
by Jonker
Today, 01:19 PM
|
||
Started by futtrader, Today, 01:16 PM
|
0 responses
9 views
0 likes
|
Last Post
by futtrader
Today, 01:16 PM
|
Comment