Anything outside that scope would be beyond what we are able to provide support for. It may or may not work. In any case you would need to try on your own.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Multiple classes within strategy
Collapse
X
-
Unfortunately we only support the inheritance model which in enforced by the strategy wizard. In addition I suggest to not use the strategy name "Trade" to avoid confusion.
Anything outside that scope would be beyond what we are able to provide support for. It may or may not work. In any case you would need to try on your own.
-
Dierk,
I want to personally thank you for this very informative reply. Particularly your closing line.
A sincere thank you,
Originally posted by NinjaTrader_Dierk View PostUnfortunately we only support the inheritance model which in enforced by the strategy wizard. In addition I suggest to not use the strategy name "Trade" to avoid confusion.
Anything outside that scope would be beyond what we are able to provide support for. It may or may not work. In any case you would need to try on your own.
Comment
-
Sefstrat,
I have been employing this technique to centralize code and I found that setting up a base class using this type of a template was very efficient.
One thing to remember is that in classes that inherit from the base, you have to do the following in your constructor.
public class MyClass : MyBaseClass
{
public MyClass(Strategy s) : base(s)
{
// put your initilizing code in here.
}
}
Originally posted by sefstrat View PostYeah Trade class should not inherit from strategy for what you are trying to do.
Pass your strategy into Trade constructor if you need to access Strategy members.
ie
public class Trade
{
Strategy s;
public Trade(Strategy strat) { s = strat; }
.....
}
then inside your strategy:
Trade t = new Trade(this);
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by sofortune, Today, 11:45 PM
|
0 responses
3 views
0 likes
|
Last Post
by sofortune
Today, 11:45 PM
|
||
Started by zzeric, Today, 11:23 PM
|
1 response
3 views
0 likes
|
Last Post Today, 11:34 PM | ||
Started by Pep de lou, Today, 08:14 PM
|
2 responses
20 views
0 likes
|
Last Post
by bltdavid
Today, 08:57 PM
|
||
Started by fingers, 12-15-2023, 08:44 AM
|
6 responses
139 views
0 likes
|
Last Post
by bltdavid
Today, 08:42 PM
|
||
Started by algospoke, 05-13-2024, 06:53 PM
|
4 responses
33 views
0 likes
|
Last Post
by algospoke
Today, 06:16 PM
|
Comment