Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Lock in Realized profit from unrealized profit at a certain number

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

    #16
    Hello rafael_delima86,

    Thanks for your reply.

    You need to have one set that is used to determine the TotalPNL only, no other actions, no conditions. This is so the TotalPNL is updated.

    In another set, you would compare the total PNL to your limit value and if true to then set a bool variable to false as the action. NOTE: I would not name the bool variable Bool as this may cause a conflict with the strategy builder. Instead, choose a name that has more meaning such as OkToTrade. You would then use the bool as part of the entry conditions by checking that the bool is true.

    Comment


      #17
      Hello Paul,
      thanks for your explanation...
      should I add “BOOL=true” on all the SETS that have conditions to enter a trade or the Bool=true should be added on all sets under actions?

      Comment


        #18
        Hello rafael_delima86,

        Thanks for your reply.

        In each set that places an entry order, you would add a check to see that the bool is true.

        in one set you will have the totalPNL gather with no conditions.

        In another set you will check that the totalPNL exceeds your limits and the action of that set will be to set the bool to false.

        You will need to consider how to reset the bool back to true. In an earlier post I suggested check if it is the first bar of the session, and that would be another set.

        Comment


          #19
          Very helpful information Paul!
          one last question... so when I create a new SET, the condition should be “Bars.IsFirstBarofSession = Bar.isFirstBarofSession” with the ACTION set to Bool=True right?

          Comment


            #20
            Hello rafael_delima86,

            Thanks for your reply.

            Bars.IsFirstBarOfSession is a bool so you want to check if the bool is true, IE: Bars.IsFirstBarOfSession == true.

            Correct, the action would be to set your bool to true.

            Comment


              #21
              So I set a bool=true on all Entries sets, PnL gathered with no other conditions or actions in another set and a PNL> my limit as a condition in another set along with BOOL=false as the action of that set. Lastly I added a set with a condition as the first bar of session and the action back to bool=true but still the strategy continues to enter trades even when it exceeded my limit PnL.....Any other options I need to add???

              Comment


                #22
                Attached are the sets that I've added

                Comment


                  #23
                  Hello

                  Thanks for your reply.

                  Your sets 7 and 9 need to be sets 1 & 2 in your strategy (you can move the tabs to resequence)

                  Please see this post where I define the critical sequence of the sets: https://ninjatrader.com/support/foru...et#post1156861

                  Set #8 condition does not make sense as you are adding the entry price and then multiplying it times tick size. Are you trying to add the realized PNL and the Unrealized PNL? If so then please review the video in post #4 of this thread.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, 03-13-2026, 05:17 AM
                  0 responses
                  87 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  151 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  80 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  53 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  62 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X