Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit and Loss Limits not working correctly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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 Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      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!

      Comment


        #4
        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 bortz, 11-06-2023, 08:04 AM
        47 responses
        1,611 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        22 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X