NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-21-2009, 10:21 AM   #1
DancesWithBears
Member
 
Join Date: Jul 2009
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default Custom Indicators calling other Custom Indicators

I am writing a system and I am trying to divide up the logic.

One custom indicator that computes moving average entry conditions has to call another custom indicator that tracks the bollinger entry conditions.

How would I call my own custom indicator?

Another related question:

I know I can call the built in standard indicators in my custom script.

But am I really calling methods on those indicators, or is it constructing the indicator on every call? That would seem expensive.

Thanks in advance..
DancesWithBears is offline  
Reply With Quote
Old 08-21-2009, 10:33 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

DancesWithBears, just as you call other custom indicators as well for example -

Code:
 
double myCustomValue= MyCustomIndicator(Parameter1, Parameter2);
An indicator automatically offers a method in NinjaScript, there's no function / indicator concept as in other trading software languages. The needed cache of indicator calls is done internally by NinjaTrader.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-21-2009, 10:57 AM   #3
DancesWithBears
Member
 
Join Date: Jul 2009
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default Think the sytax looks like this

Bertrand,

Think I got it right but you can please confirm.
I construct a Custom Indicator object then call method on it.

// in my other custom indicator body
MyCustomerIndicator myCustomIndicator(Parameter1, Parameter2);

myCustomIndicator.DoThis();
myCustomIndicator.DoThat();

I just wanted to avoid creating another instance of the indicator.
But you are saying that the system won't if it sees the same constructor arguments that match an object already instantiated. (caches).

Seems logical.


Quote:
Originally Posted by NinjaTrader_Bertrand View Post
DancesWithBears, just as you call other custom indicators as well for example -

Code:
 
double myCustomValue= MyCustomIndicator(Parameter1, Parameter2);
An indicator automatically offers a method in NinjaScript, there's no function / indicator concept as in other trading software languages. The needed cache of indicator calls is done internally by NinjaTrader.
DancesWithBears is offline  
Reply With Quote
Old 08-21-2009, 11:04 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

DancesWithBears, yes that is correct, you could also use the UserDefinedMethods for this purpose - http://www.ninjatrader-support.com/H...verview45.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-21-2009, 11:17 AM   #5
DancesWithBears
Member
 
Join Date: Jul 2009
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default That was my next question and you already answered it.

Tausend Dank! A thousand thanks! Thanks very much!
DancesWithBears is offline  
Reply With Quote
Old 08-21-2009, 11:28 AM   #6
DancesWithBears
Member
 
Join Date: Jul 2009
Posts: 53
Thanks: 0
Thanked 0 times in 0 posts
Default Problem exporting when I use

Getting "error compiling sources" when I try to export now.
After I put my functions in UserDefinedMethods.cs.

hmm..

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
DancesWithBears, yes that is correct, you could also use the UserDefinedMethods for this purpose - http://www.ninjatrader-support.com/H...verview45.html
DancesWithBears is offline  
Reply With Quote
Old 08-21-2009, 12:19 PM   #7
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

Yes, unfortunately you can't export UserDefinedMethods
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Indicators meyer99 Charting 6 05-25-2009 04:09 AM
Custom Indicators again ... murfinp Strategy Development 3 04-16-2009 08:31 AM
Custom Indicators missing monpere Installation and Licensing 2 03-04-2009 06:43 AM
Can't import custom indicators T2020 Indicator Development 4 08-07-2008 08:03 AM
Two color custom indicators stefy Indicator Development 1 05-16-2008 11:41 AM


All times are GMT -6. The time now is 03:29 AM.