Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Positons Exits based on AccountPos
Collapse
X
-
Positons Exits based on AccountPos
We all have occasional computer downtime, therefore strategies that have open positions get disabled and we are left with account positions that are only exitable on re-enabling of the strategy by using the following logic:
// Exits
if (BarsInProgress == i
&& PositionsAccount[i].MarketPosition == MarketPosition.Short
&& Closes[i][0] <= MIN(Closes[i],5)[0])
{
EnterLong(i,PositionsAccount[i].Quantity,"ExitShort"+i);
}
The problem is that the first action from EnterLong is to close the short positions... then add a new long position. So to get around this problem we try using:
if (BarsInProgress == i
&& PositionsAccount[i].MarketPosition == MarketPosition.Short
&& Closes[i][0] <= MIN(Closes[i],5)[0])
{
ExitShort(i,PositionsAccount[i].Quantity,"SwingShort"+i,"ExitShort"+i);
}
Problem here is that as the strategy was disabled... that "SwingShort" positions entry is no longer valid and visible to the newly enabled strategy.
Conclusion: All swing traders need a way to continue managing existing positions upon strategy re-enable. Is there a way to achieve this with occasional computer downtime when you cannot rely on the strategy position object? Regards and thx to allLast edited by elliot5; 08-29-2016, 01:07 AM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cls71, Today, 04:45 AM
|
1 response
7 views
0 likes
|
Last Post Today, 07:25 AM | ||
Started by TradeForge, Today, 02:09 AM
|
1 response
22 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by elirion, Today, 01:36 AM
|
2 responses
13 views
0 likes
|
Last Post
by elirion
Today, 07:21 AM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
5 responses
14 views
0 likes
|
Last Post Today, 07:18 AM | ||
Started by samish18, Yesterday, 08:31 AM
|
4 responses
14 views
0 likes
|
Last Post
by elirion
Today, 07:15 AM
|