Trading Articles
Article Categories
Article Tools
Get plot value through reflection
Updated March 3, 2015
trending_up
766 views
thumb_up
0 thanks given
group
2 followers
forum
6 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Get plot value through reflection
(login for full post details)
#1 (permalink )
Cochin
Posts: 8 since Dec 2014
Thanks: 1 given,
0
received
I am able to get the value of middle band of Bollinger with the below code.
Code
double value = Bollinger(2,14).Values[1][0];
How can I do it with Reflection ? Below is the code I have tried so far.
Code
Type[] dataTypes = null;
MethodInfo methodInfo = null;
object[] params = new object[2];
// Some code to get data types of method to "dataTypes" (System.Double,System.Int32)
// Some code to get parameters for the method to "params" (2,14)
// Some code to get information to "methodInfo" (Bollinger(2,14))
IDataSeries dataSeries = (IDataSeries)methodInfo.Invoke(this, params);
double value = dataSeries[0];
When I execute the above statement , I could get the value(for example,1650.00) in the variable "value". The issue is, I could not specify the band ,ie, Upper or Middle or Lower . I tried the below code.
Code
double value = dataSeries.Values[1][0];
but didn't work and throws error. Is there a way out?
Thanks in advance,
thesarath
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
Market Wizard
Berlin, Europe
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,855 since Mar 2010
Thanks: 4,238 given,
26,728
received
What do you need it for, I mean what is the purpose of the whole exercise?
(login for full post details)
#4 (permalink )
Cochin
Posts: 8 since Dec 2014
Thanks: 1 given,
0
received
Fat Tails
What do you need it for, I mean what is the purpose of the whole exercise?
I can select a set of indicators from a list, can select the plot for each indicator and need to get each indicator's plot value at runtime.
(login for full post details)
#5 (permalink )
Market Wizard
Berlin, Europe
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,855 since Mar 2010
Thanks: 4,238 given,
26,728
received
thesarath
I can select a set of indicators from a list, can select the plot for each indicator and need to get each indicator's plot value at runtime.
I have used an enum for the list of indicators and then attributed the selected indicators to an IDataSeries object in OnStartUp. An example would be the SuperTrendU11, which works with 29 different moving averages. It can be downloaded here:
Is that the solution you look for, or do you try to instantiate indicators dynamically?
PS: I just saw that you cannot download files, as you are not an elite member. Please send me a private message with your e-mail and I will send you the indicator, so that you can check it.
(login for full post details)
#6 (permalink )
Cochin
Posts: 8 since Dec 2014
Thanks: 1 given,
0
received
Fat Tails
I have used an enum for the list of indicators and then attributed the selected indicators to an IDataSeries object in OnStartUp. An example would be the SuperTrendU11, which works with 29 different moving averages. It can be downloaded here:
Is that the solution you look for, or do you try to instantiate indicators dynamically?
PS: I just saw that you cannot download files, as you are not an elite member. Please send me a private message with your e-mail and I will send you the indicator, so that you can check it.
Yes. I instantiate the indicators dynamically at runtime in a loop and store them in a List<IDataSeries> .
(login for full post details)
#7 (permalink )
Market Wizard
Berlin, Europe
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,855 since Mar 2010
Thanks: 4,238 given,
26,728
received
thesarath
Yes. I instantiate the indicators dynamically at runtime in a loop and store them in a List<IDataSeries> .
But do you want to select the indicators from a dropdown list, or would you prefer instantiating them by using a string?
I have sent you the SuperTrendU11, so you can check whether that solution would work for you.
Last Updated on March 3, 2015
Right now
Ongoing
Coming soon
March
Register to Attend
Elite only
Register to Attend
Elite only
Right now
April