Im using PositionAccount.MarketPosition == MarketPosition.Flat on real time trades and is working perfectly. Same is not happening on historical, and I want to simulate my strategy behaviour as if real, but this is not happening. Each time there is a new signal on historical, current position is CLOSED and it goes in the other direction. How I can disable to take a new position if market is not flat but on historical trades?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Only take trades when flat BUT on historical trades
Collapse
X
-
Only take trades when flat BUT on historical trades
Hello guys,
Im using PositionAccount.MarketPosition == MarketPosition.Flat on real time trades and is working perfectly. Same is not happening on historical, and I want to simulate my strategy behaviour as if real, but this is not happening. Each time there is a new signal on historical, current position is CLOSED and it goes in the other direction. How I can disable to take a new position if market is not flat but on historical trades?Tags: None
-
Hello facuevasm,
Thanks for your first post!
PositionsAccount would only be modified for trades submitted to the account live. Submitting an order during historical processing will change the strategy's position and will not change the account position.
You can use the Position object instead of PositionsAccount which will reflect the strategy position and the strategy position will change with each historical or realtime trade that is placed.
If you want the strategy to ignore creating a historical position, you can ignore historical processing with if (State == State.Historical) return;
If you want to have the strategy inherit the account position, you can follow the example attached which uses the Unmanaged Approach.
More information on Strategy vs. Account position and start behaviors are included below.
Strategy vs. Account Position — https://ninjatrader.com/support/help..._account_p.htm
Start Behaviors — https://ninjatrader.com/support/help..._positions.htm
If this does not resolve your inquiry, could you elaborate on what you would like the strategy to do with historical and realtime processing?
We look forward to assisting.Attached Files
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
52 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment