NexusFi: Find Your Edge


Home Menu

 





Get plot value through reflection


Discussion in NinjaTrader

Updated
    1. trending_up 1,887 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
thesarath
Cochin
 
Posts: 8 since Dec 2014
Thanks Given: 1
Thanks Received: 0

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

Can you help answer these questions
from other members on NexusFi?
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


What do you need it for, I mean what is the purpose of the whole exercise?


Reply With Quote
  #4 (permalink)
thesarath
Cochin
 
Posts: 8 since Dec 2014
Thanks Given: 1
Thanks Received: 0


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
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


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:

https://nexusfi.com/download/ninjatrader-7/indicators/1207-download.html?view

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
  #6 (permalink)
thesarath
Cochin
 
Posts: 8 since Dec 2014
Thanks Given: 1
Thanks Received: 0


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:

https://nexusfi.com/download/ninjatrader-7/indicators/1207-download.html?view

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
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


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




Last Updated on March 3, 2015


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts