Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Cumulative pnl tracking
Collapse
X
-
Cumulative pnl tracking
I have one strategy that I run several times a day, after every session the strategy disables itself and an auto clicker re-enables it at different trading times throughout the day. My question is: how do I store a cumulative pnl from each session, that is updated after every trade, and is then continually tracked to each instance of the strategy? my goal is to set a cumulative daily loss limit, and if reached within any one of the instances, the auto- enabled instances will not continue trading.Tags: None
-
Hello ryjoga,
I would suggest to avoid disabling the strategy if you want to accumulate pnl, each time you disable and re enable the strategy it won't know about the previous runs values, those are all cleared out to start the new instance of the strategy. You can use time conditions to exit or prevent trading instead of actually disabling the strategy.
-
Well, I have set a profit target limit and when it’s reached, it exits the position and disables the strategy. The reason I have to do that is if I use the close position call from NT it sends a sell/buy order to close, but I’m using Replikanto for follower accounts and that reads the close order call as a new position entry. I don’t want that. So I have to flatten position and exit strategy. I’ve read that I can save a pnl to a file after each instance closes, and then when I re-enable a new instance it will load that file and read the last pnl and add it to new instance. ? How does that work?Last edited by ryjoga; 06-17-2024, 12:03 PM.
Comment
-
Hello ryjoga,
Regarding saving to file, there is nothing like that built into the platform for strategies. While you can save a value to a text file in C# and read that file at a later time to get the value you saved that won't apply back any values to the strategy its self. That would strictly be for your logic to use but all strategy based properties like its position, PnL, sync with the account, trade/performance information will still be cleared. It would still work like it does now when re enabling to the overall platform. The only way to keep the strategy knowing all of those details would be to keep it enabled. If you are trying to set a profit limit you would generally need to do that in the strategy itself. That is so it can know when to stop trading and submit orders to exit or do whatever it needs to do. From there it could remain enabled and then wait until the next trading session or when you want it to start trading again.
I wouldn't be able to comment on the third party item and how that works in this situation, you may want to contact the developer of that item to see if they have a specific way they suggest to handle your individual use case while using their product.
Comment
-
Ok, how would I set a profit limit, say $300, during the hours of 2am-3am, once it hits that goal of $300, it stops trading. Still leaving the strategy enabled, have another trading period from 7am-8am, which has a profit limit for that times session of $300 too.. and continue that idea through multiple timed session on one chart/instance. What would be the method to call?
Comment
-
Hello ryjoga,
You can see the following links for some examples of that concept. The second link is if you are using the strategy builder. Because the strategy retains data some math is required to find out the current sessions Pnl. Both samples demonstrate a daily loss which can be converted to a daily profit by switching to checking if the value is greater equal to the target amount.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
20 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
119 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
63 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
45 views
0 likes
|
Last Post
|

Comment