Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Paul H.NinjaTrader Customer Service

    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.
        Paul H.NinjaTrader Customer Service

        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.
            Paul H.NinjaTrader Customer Service

            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.

                  Paul H.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by burtoninlondon, Today, 12:38 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post burtoninlondon  
                  Started by AaronKoRn, Yesterday, 09:49 PM
                  0 responses
                  14 views
                  0 likes
                  Last Post AaronKoRn  
                  Started by carnitron, Yesterday, 08:42 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post carnitron  
                  Started by strategist007, Yesterday, 07:51 PM
                  0 responses
                  13 views
                  0 likes
                  Last Post strategist007  
                  Started by StockTrader88, 03-06-2021, 08:58 AM
                  44 responses
                  3,983 views
                  3 likes
                  Last Post jhudas88  
                  Working...
                  X