Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy and Indicator superclass
Collapse
X
-
Maybe I don't know enough C# but I thought that wouldn't be possible, since I want to use the LogHelper in indicators and in strategies - are you saying I can code partial class that is a partial class of both Strategy and of Indicator? And aren't namespaces an issue?Originally posted by koganam View PostAll the more reason to use partial classes. All those methods are then natively available.
And when you say "natively available", do you mean that instead of
I could just do this?:Code:logHelper.log("stuff");
Code:log("stuff");
Comment
-
Hello adamus,
While partial classes are something that we cannot support here are a few examples that may help you out.
I was wondering if someone could give me an overview of why I would use them and what advantage I would gain in the process.
JCNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_JC View PostHello adamus,
While partial classes are something that we cannot support here are a few examples that may help you out.
I was wondering if someone could give me an overview of why I would use them and what advantage I would gain in the process.
http://msdn.microsoft.com/en-us/library/wa80x488.aspx
Huh? Do you support UserDefinedMethods.cs that you ship? They are partial classes.
Comment
-
Not quite. That would depend on how you define/override the method. OTOH, you would not have to say Indicator.Print() or Indicator.Log(), nor their Strategy analogs, as they would both be natively supported as simply Print() and Log(). While you can embed a class in another class, that would not even be necessary. You could pretty much just define them as methods of the partial class itself, and call them as necessary.Originally posted by adamus View PostMaybe I don't know enough C# but I thought that wouldn't be possible, since I want to use the LogHelper in indicators and in strategies - are you saying I can code partial class that is a partial class of both Strategy and of Indicator? And aren't namespaces an issue?
And when you say "natively available", do you mean that instead of
I could just do this?:Code:logHelper.log("stuff");
Code:log("stuff");
Comment
-
OK thanks. But wouldn't I have to maintain two different versions of my log-helper stuff? One for Indicator namespace and one for the Strategy namespace?Originally posted by koganam View PostNot quite. That would depend on how you define/override the method. OTOH, you would not have to say Indicator.Print() or Indicator.Log(), nor their Strategy analogs, as they would both be natively supported as simply Print() and Log(). While you can embed a class in another class, that would not even be necessary. You could pretty much just define them as as methods of the partial class itself, and call them as necessary.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
661 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
376 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
110 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
580 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment