I've created a condition to limit profit and loss but it doesn't take any trades when it's on. I've created a bool that defaults to true that is required to enter a trade. I've then created a condition that if either the Profit target < realized profit or Loss Limit is > realized profit the bool is set to false. If I change the condition to use unrealized PnL the strategy takes trades but unfortunately unrealized PnL isn't useful for what I'm trying to accomplish. It behaves as if it is getting an invalid number for realized PnL and simply setting the bool to false. The account tabs displays the realized PnL as $0.00. I've spent way too much time trying to setup a very simple condition. Please help.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Profit and Loss Limits not working correctly
Collapse
X
-
Profit and Loss Limits not working correctly
Hello,
I've created a condition to limit profit and loss but it doesn't take any trades when it's on. I've created a bool that defaults to true that is required to enter a trade. I've then created a condition that if either the Profit target < realized profit or Loss Limit is > realized profit the bool is set to false. If I change the condition to use unrealized PnL the strategy takes trades but unfortunately unrealized PnL isn't useful for what I'm trying to accomplish. It behaves as if it is getting an invalid number for realized PnL and simply setting the bool to false. The account tabs displays the realized PnL as $0.00. I've spent way too much time trying to setup a very simple condition. Please help.1 PhotoTags: None
-
Hello mattdowns1234,
Thank you for your note.
If you scroll back on the chart historically, do you see the strategy take some trades and then stop on the historical data?
Keep in mind that Realized PnL is counting trades the strategy took historically, so if you're not specifying that orders are not sent until the State is Realtime, it's likely hitting one of the other of your realized profit levels long before it reaches real time data.
I'm attaching an example Strategy Builder script that demonstrates how to create a daily loss limit, you could certainly modify this to also cease trading if a daily profit target is exceeded as well.
Please let us know if we may be of further assistance to you.Attached FilesKate W.NinjaTrader Customer Service
-
Hi Kate,
Thank you for the example. I tried to build it exactly the same as the example but it still continues to take trades even after the realized PnL is far below the daily limit. I've attached the script. I've been over it a dozen times and I can't find how my strategy is different. Help!2 Photos
Comment
-
Hello mattdowns1234,
Thank you for your reply.
It looks like the order in which you created your sets is different and this would definitely cause issues. I'd recommend hitting the View Code button on the example in the Builder, you'll see the order in which things occur is different. For example, in your script you're not calculating YesterdaysPNL or StrategyTotalPNL for the bar until after you've already potentially entered. The order of the sets is very important, so I'd compare the two to see the correct order things should be in.
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
21 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
30 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
||
Started by catinabag, 04-13-2023, 05:46 AM
|
34 responses
1,460 views
0 likes
|
Last Post
by mcosta72
Today, 04:44 PM
|
||
Started by adeelshahzad, Today, 11:49 AM
|
6 responses
23 views
0 likes
|
Last Post
by mcosta72
Today, 04:35 PM
|
||
Started by sidlercom80, 05-05-2020, 07:20 AM
|
4 responses
304 views
0 likes
|
Last Post
by Bidder
Today, 04:35 PM
|
Comment