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 fafafdenis, Today, 04:56 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by pjsmith, 07-18-2019, 04:21 AM
        7 responses
        249 views
        0 likes
        Last Post aligator  
        Started by ark321, Today, 05:12 PM
        0 responses
        11 views
        0 likes
        Last Post ark321
        by ark321
         
        Started by futurenow, Today, 04:49 PM
        0 responses
        9 views
        0 likes
        Last Post futurenow  
        Started by ofer1964spivak, Today, 04:27 PM
        0 responses
        5 views
        0 likes
        Last Post ofer1964spivak  
        Working...
        X