![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2011
Posts: 143
Thanks: 41
Thanked 3 times in 3 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,555
Thanks: 261
Thanked 1,013 times in 994 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: 143
Thanks: 41
Thanked 3 times in 3 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,555
Thanks: 261
Thanked 1,013 times in 994 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: 143
Thanks: 41
Thanked 3 times in 3 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 54 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 |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Nov 2011
Posts: 143
Thanks: 41
Thanked 3 times in 3 posts
|
I guess a little example would be helpful. I will try to split the code into different cs-files and hopefullt report the results here.
|
|
|
|
![]() |
| 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 |