Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple Stratergies, one symbol.
Collapse
X
-
-
...more to this...it's not just multiples, I can do it with single strategies as well.
My code looks like this
protected override void OnMarketDepth(MarketDepthEventArgs e)
{
if (Historical)
{
return;
}
bool buy = yada...
bool sell = yada...
if (Position.MarketPosition == MarketPosition.Flat)
{
if (buy)
{
EnterLong();
}
if (sell)
{
EnterShort();
}
}
else
{
if (Position.MarketPosition == MarketPosition.Long && sell)
{
EnterShort();
}
if (Position.MarketPosition == MarketPosition.Short && buy)
{
EnterLong();
}
}
}
It seems that the Historical check sometimes fails when the strategy is started out of session time, leading to the 'Enter' call which throws.
-
I suggest debugging your strategy as per here: http://www.ninjatrader-support.com/v...ead.php?t=3418
Comment
-
Comment
-
Hi CraigC,
Please check out this tip. You are most likely running into this issue: http://www.ninjatrader-support.com/v...ead.php?t=4226Josh P.NinjaTrader Customer Service
Comment
-
I'm not sure what I should checking for NULL, as I only access 'Historical' and 'EnterLong()'. Enter long is a function so I can't check that and 'Historical' is a property on the current strategy instance (which I assume is created otherwise we would not be in the function in the first place) so I can't check it for NULL either. On top of that it is the EnterLong() that is throwing the exception, should not the 'Historical' check have returned true given the setup which I quote I my previous post? Sorry if I'm missing something here.Last edited by CraigC; 06-23-2008, 10:18 PM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by kinfxhk, 07-14-2026, 09:39 AM
|
0 responses
93 views
0 likes
|
Last Post
by kinfxhk
07-14-2026, 09:39 AM
|
||
|
Started by kinfxhk, 07-13-2026, 10:18 AM
|
0 responses
93 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 10:18 AM
|
||
|
Started by kinfxhk, 07-13-2026, 09:50 AM
|
0 responses
71 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 09:50 AM
|
||
|
Started by kinfxhk, 07-13-2026, 07:21 AM
|
0 responses
88 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 07:21 AM
|
||
|
Started by kinfxhk, 07-11-2026, 02:11 AM
|
0 responses
67 views
0 likes
|
Last Post
by kinfxhk
07-11-2026, 02:11 AM
|

Comment