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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
157 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
91 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
143 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
131 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment