Get plot value through reflection - futures io
futures io futures trading



Get plot value through reflection


Discussion in NinjaTrader

Updated
    1. trending_up 766 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. 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)

 
Search this Thread
 

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

Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
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?

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Cochin
 
 
Posts: 8 since Dec 2014
Thanks: 1 given, 0 received


Fat Tails View Post
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.

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


thesarath View Post
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.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Cochin
 
 
Posts: 8 since Dec 2014
Thanks: 1 given, 0 received


Fat Tails View Post
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>.

Reply With Quote
 
(login for full post details)
  #7 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


thesarath View Post
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.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Get plot value through reflection


Last Updated on March 3, 2015


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts