![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Nov 2011
Posts: 136
Thanks: 41
Thanked 2 times in 2 posts
|
Sorry, probably this question is already answered but I could found it through the search.
Is it possible to have multiple sources for a strategy/indicator? Thank you. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
Hi Alex, what would you mean please by mutiple sources? Do you mean data series / instruments?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2011
Posts: 136
Thanks: 41
Thanked 2 times in 2 posts
|
Hi Bertrand,
No, I mean multiple cs files. For instance, to use partial class definition or even different classes, because sometimes strategies get quite big for a single source file. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
I see, strategies could not call other strategies, but you could call for example methods from UserDefinedMethods.cs or other indicators of course.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Bertrand for this post: |
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2011
Posts: 136
Thanks: 41
Thanked 2 times in 2 posts
|
Can I use partial class definition for an indicator/strategy? Can I use a non-indicator class from within a separate cs file?
I mean, there must be ways to split the code of an indicator/strategy into several files. |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Feb 2009
Posts: 285
Thanks: 2
Thanked 52 times in 41 posts
|
ninjascript is all C#. just create your custom namespace and do whatever you like. Strategies/Indicators are partial class by itself (see UerDefinedMethod.cs file).
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Jan 2009
Posts: 584
Thanks: 2
Thanked 21 times in 12 posts
|
yes you can use multiple C# files and partial classes.
Only limitation are Indicator derived classes. For these Ninja generates a custom script a the bottom of the file. Having 2 source code files for the same indicator derived class will probably mess that mechanism up. But try it, as you will see errors at compile time. Andreas www.zweisteintrading.eu |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to protect your source file | richard | Indicator Development | 9 | 07-23-2012 11:33 PM |
| Two source of input for 1 indicator | Oil_Trader | Automated Trading | 1 | 08-19-2010 06:13 PM |
| where is the ninja source file for debugging | junkone | Miscellaneous Support | 5 | 08-22-2009 11:40 PM |
| Possible to have one source file include multiple indicators | DancesWithBears | Indicator Development | 1 | 07-28-2009 04:03 AM |
| Indicator: Using System.IO File properties to write to and read from a text file | NinjaTrader_Josh | Reference Samples | 0 | 09-30-2007 10:48 PM |