NexusFi: Find Your Edge


Home Menu

 





Get value of Third-party indicators


Discussion in NinjaTrader

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




 
Search this Thread

Get value of Third-party indicators

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

How can I get the value of Third-party indicator?

I could get SMA's value with the below code

 
Code
var val = SMA(14)[0];
but i cannot get KPMWAP's value with the below code

 
Code
var val = KPMWAP(3)[0];
Its showing the below error

'NinjaTrader.Indicator.KPMWAP' is a 'type' but is used like a 'variable'

Should KPMWAP be instantiated?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
What broker to use for trading palladium futures
Commodities
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
 Jack22 
Washington DC
 
Experience: Beginner
Platform: NinjaTrader7
Trading: ES
Posts: 74 since Oct 2010
Thanks Given: 108
Thanks Received: 84


thesarath View Post
How can I get the value of Third-party indicator?

I could get SMA's value with the below code

 
Code
var val = SMA(14)[0];
but i cannot get KPMWAP's value with the below code

 
Code
var val = KPMWAP(3)[0];
Its showing the below error

'NinjaTrader.Indicator.KPMWAP' is a 'type' but is used like a 'variable'

Should KPMWAP be instantiated?

One assumption is that the vendor has coded the indicator so you are able to reference it. Here are the other things to check:

1. Open a Ninjascript in Ninja to edit the code, right click, go to references, make sure the DLL is referenced--if its not, add the reference (there are other threads that describe this). Restart Ninja if it was already there
2. Go to bin\Custom and make sure there is a CS file with the same name as your DLL. Add the CS if it wasn't there and restart and compile
3. Open the CS file
4. In the CS file, find the name of the indicator that you are trying to reference. If you can't find it, you are out of luck. Even if you can find it, does not mean you are in the clear yet
5. You want the part that looks like "public INDICATOR_NAME (Color variable1, bool variable2, int variable 3, etc.) { return INDICATOR_NAME(variable1, variable2, variable3) }"--replace everything in quotes with the specific variables and names for your indicator
6. Now, in the indicator you are trying to use to reference the vendors indicator, you will need to reference it using everything in step 5. Some vendors leave it blank, so you will have to reference the indicator like this: IndicatorName().
7. Assuming you make it to step 6, you will have to use Ninja intellisense to finish reference the public portion of the DLL, which sometimes is not public, so you could do all this work and it could be for nothing. Enter the reference for the indicator (i.e. IndicatorReference(variable1, variable2, variable 3)) and then put a period after it and Ninja should bring up a list of public variables for that indicator. If it doesn't then you can try one more thing
8. Go to the vendor indicator and in the parameters area, see if a plot is at the bottom where you can change the color and dash styles. Get the name of the plot and try referencing it in step 7. If that doesn't work, go to the vendor and ask them to make the variables public so you can reference them externally

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



Jack22 View Post
One assumption is that the vendor has coded the indicator so you are able to reference it. Here are the other things to check:

1. Open a Ninjascript in Ninja to edit the code, right click, go to references, make sure the DLL is referenced--if its not, add the reference (there are other threads that describe this). Restart Ninja if it was already there
2. Go to bin\Custom and make sure there is a CS file with the same name as your DLL. Add the CS if it wasn't there and restart and compile
3. Open the CS file
4. In the CS file, find the name of the indicator that you are trying to reference. If you can't find it, you are out of luck. Even if you can find it, does not mean you are in the clear yet
5. You want the part that looks like "public INDICATOR_NAME (Color variable1, bool variable2, int variable 3, etc.) { return INDICATOR_NAME(variable1, variable2, variable3) }"--replace everything in quotes with the specific variables and names for your indicator
6. Now, in the indicator you are trying to use to reference the vendors indicator, you will need to reference it using everything in step 5. Some vendors leave it blank, so you will have to reference the indicator like this: IndicatorName().
7. Assuming you make it to step 6, you will have to use Ninja intellisense to finish reference the public portion of the DLL, which sometimes is not public, so you could do all this work and it could be for nothing. Enter the reference for the indicator (i.e. IndicatorReference(variable1, variable2, variable 3)) and then put a period after it and Ninja should bring up a list of public variables for that indicator. If it doesn't then you can try one more thing
8. Go to the vendor indicator and in the parameters area, see if a plot is at the bottom where you can change the color and dash styles. Get the name of the plot and try referencing it in step 7. If that doesn't work, go to the vendor and ask them to make the variables public so you can reference them externally

Thanks Jack for your valuable reply.
1. I actually cannot add reference because, the user can add dll in custom directory and I think user will not add reference to each new dll each time.
2. I use Reflection to get the DataSeries (for SMA any other Ninja's indicator, I can get DataSeries)

 
Code
Type type = base.GetType();
MethodInfo mi = type.GetMethod("SMA", new Type[] { Type.GetType("System.Int32") });
DataSeries dataSeries  = new DataSeries((IndicatorBase)mi.Invoke(this, new object[] { 14 }));
but I cannot get the DataSeries for Third-party indicators with the below code(Note that GetTypeFromAllAssemblies() is a method which loop through all assemblies and return as Type)

 
Code
Type type = this.GetTypeFromAllAssemblies("NinjaTrader.Indicator.KPMWAP");
MethodInfo mi = type.GetMethod("KPMWAP", new Type[] { Type.GetType("System.Int32") });
DataSeries dataSeries  = new DataSeries((IndicatorBase)mi.Invoke(this, new object[] { 3 }))
What is the possible way to get DataSeries for Third-party indicators?

Reply With Quote




Last Updated on March 5, 2015


© 2024 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 - Privacy Policy - Downloads - Top
no new posts