If I have several strategies working on different charts (all on the same real account) and in one of these strategies I call "Account.FlattenEverything", are the positions of all the products/charts closed?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
FlattenEverything
Collapse
X
-
Hello soyjesus,
I am not able to reproduce this behavior.
To test I have created Sim102 account and opened a long position on both Sim101 and Sim102.
Then in an indicator, I have called
Account myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim102");
myAccount.Flatten(new [] { Instrument.GetInstrument("ES 12-21") });
Only the position on the Sim102 account was flattened.
Below is a link to a video of the test.
https://drive.google.com/file/d/1_E7...w?usp=drivesdk
This indicates that <Account>.Flatten() does work as intended.
If you are wanting to flatten only the strategy position in a NinjaScript Strategy. Call ExitLong() and ExitShort() in the strategy.Chelsea B.NinjaTrader Customer Service
- Likes 3
Comment
-
Hello Chelsea and thanks for that helpful demo.Originally posted by NinjaTrader_ChelseaB View PostHello soyjesus,
I am not able to reproduce this behavior.
To test I have created Sim102 account and opened a long position on both Sim101 and Sim102.
Then in an indicator, I have called
Account myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim102");
myAccount.Flatten(new [] { Instrument.GetInstrument("ES 12-21") });
Only the position on the Sim102 account was flattened.
Below is a link to a video of the test.
https://drive.google.com/file/d/1_E7...w?usp=drivesdk
This indicates that <Account>.Flatten() does work as intended.
If you are wanting to flatten only the strategy position in a NinjaScript Strategy. Call ExitLong() and ExitShort() in the strategy.
I'm wondering how to make the Flatten() method apply to whatever instrument of the chart the indicator is loaded on instead of a predefined string.
I can't find the syntax in the doc
How would it work? Thanks!Last edited by PaulMohn; 06-13-2022, 09:25 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
61 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
34 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
198 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
364 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
283 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment