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

Profit (and Loss) Targets question

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

    Profit (and Loss) Targets question

    I want to know how to use both if they both exist...
    (1) the profit/loss target for the particular instance of the strategy engaging and...
    (2) the total overall profit balance of the trades for that day for that account.

    To simplyfy my question lets just focus on Profit Target.

    I see "Profit target" & "Profit target total position (cash)" as options to add within the Strategy Action component of the Wizard.
    Is "Profit target" for just this instance of the strategy engaging and is "Profit target total position (cash)" what I'm looking for as the total Profit in that account for the day?

    I've looked here but can't find my answer: https://ninjatrader.com/support/help...ofittarget.htm

    #2
    Hello RonnieB,

    Thanks for your post.

    You are referencing the "Wizard" which is a name used in NinjaTrader7 for generating strategies. Just for confirmation, are you using the Strategy Builder in NinjaTrader8?

    The Profit target would be what you would apply to each entry made by the strategy. Using this, you could have different entries with different signal names each with their own profit target/stop. The use of signal names is discussed in the manged approach here: https://ninjatrader.com/support/help...d_approach.htm

    The Profit target total position (cash) would apply to as the name implies all open positions, this would not be for the total of the day but for all active trades. I think you are wanting to access the Realized PNL which would be the accumulated profit/loss of the strategy, which can be accessed in the conditions of a set by Strategy>realizedPNL

    If you are using the strategy builder, please see the help guide here for additional information: https://ninjatrader.com/support/help...gy_builder.htm

    You can also attend free live on-line training on the strategy builder here: https://ninjatrader.com/Webinar/Strategy-Builder-301

    Last edited by NinjaTrader_PaulH; 09-25-2019, 06:37 AM. Reason: Moved thread from add-on to NT8 strategy development
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I am currently using the wizard for building strategies and nt7 But ultimately my goal will be to get things started and then have a programmer put final touches on a strategy that will be used in ninjatrader 8. I happen to be using nt7 now but plan on migrating to nt8 in the near future, clear as mud a?

      Thanks for your suggestions above I will look into those regarding total pnl for the profit Target related to the account. Your comments have been very helpful so far, thanks again.

      Comment


        #4
        I'm definately using Strategy Builder now in NT8...

        I'm not sure I understand what the "Realized PNL" parameter represents. I tried to search on that and got nowhere fast.
        Is the "Realized PNL" for the overall Account or for ALL accounts? I'm wanting something that looks at the "Realized PNL" figures per account so I can test various strategy setups running at the same time and only that particular account using the strategy checks on its "Realized PNL". Is that how it is supposed to work using the suggestion below

        " I think you are wanting to access the Realized PNL which would be the accumulated profit/loss of the strategy, which can be accessed in the conditions of a set by Strategy>realizedPNL"

        Comment


          #5
          Hello RonnieB,

          Thanks for your reply.

          In the strategy builder of NT8, the "realizedPnl" would relate to the strategy only and would include any historical trades results made by the strategy (unless programmed not to make any historical trades). For example if you apply a strategy to a chart with 5 days of data loaded, the strategy will process all 5 days before connecting to real time data and will perform historical trades over that duration and the results of those trades are accumulated into the RealizedPNL of the strategy. So the RealizedPNL is the accumulated total of all trades made, historical and real time, by the strategy. It does not represent or know of any other strategy or account.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Thanks Paul,
            If My goal is to have a Realized PNL per strategy that look at the Realized Profit per session (i.e. when the strategy was last enabled until now), is that possible to do?. i.e. I'm looking for the strategy to STOP and not take any more trades once it hits a set Realized PNL for that session like +$500, stop trading [I also have a -$500 stop trading per Realized PNL for a StopLoss per session].

            Comment


              #7
              Hello RonnieB,

              Thanks for your reply.

              Yes, it is possible to do that. You can add an "entry" condition that stipulates the current state is equal to state Real time. Please note that you would need to enable the strategy each day for this to function as you wish.

              As far as a PNL limit, you can have a "set check the PNL value and if it exceeds your limit value, the action would be to set a bool to false. That bool would also be used as an "entry condition", thus prevent further entries.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                That's great to hear Paul.
                I don't know how to add what you are saying yet (add an "entry" condition that stipulates the current state is equal to state Real time) nor ("set check the PNL value and if it exceeds your limit value, the action would be to set a bool to false. That bool would also be used as an "entry condition") - which is exactly what I'm going for and I do plan on re-enabling the strategy each day/session - but I'll poke at it for a while to see if I can figure it out.

                If you know of a place for me to research how to do what you've mentioned I'd be happy to look at it while I'm doing my own 'poking'.

                Thanks

                Comment


                  #9
                  Hello RonnieB,

                  Thanks for your reply.

                  The variable is created on the "inputs and variables" screen. Please see: " Understanding the Inputs and Variables screen" on this page: https://ninjatrader.com/support/help...er_screens.htm

                  The state condition is found in the conditions builder under the Misc folder. you would use Current state on the left, equal in the middle and State real time on the right.

                  I would suggest reviewing the strategy builder webinar here: https://www.youtube.com/watch?v=HCyt...We0Nf&index=11
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Paul,
                    I promise I will view the webinar, but you know how it is.. I had to try poking around with the excellent info you shared with me first!

                    See the attached image for context for the next question...

                    "OKtoTrade is a bool variable which I have set to be True in the "Inputs and Variables" area, where do I go to set an if/then statement that changes it to be "False" when I exceed a user defined value like my "MaxProfitPerSession" value (i.e. +$500)
                    Attached Files

                    Comment


                      #11
                      Hello RonnieB,

                      Thanks for your reply.

                      You would use another "set". The condition you already know which is to compare the RealizedPNL to your level that stops trading. In the action side of that set you would set the okayToTrade to false.

                      Paul H.NinjaTrader Customer Service

                      Comment


                        #12
                        Thanks for your help Paul, I'm not sure what I'm doing wrong but my strategy setup is not taking any trades as it stands. Is there a place where I can send my code for the strategy or share it another way where someone can look at it and give advice as to what is not set up properly?

                        Comment


                          #13
                          Hello RonnieB,

                          Thanks for your reply.

                          Please note that we do not provide strategy building, code writing or debugging services. That said, we certainly want to help you succeed on your own.

                          If your strategy is not placing trades, first make sure that it is being "enabled" (if testing on live or market replay data).
                          If backtesting in the strategy analyzer, make sure you have the data for the analysis period you are testing, an easy way to check this would be using the SampleMAcrossover strategy in your NinjaTrader which will always produced trades (if there is data!!)

                          If you are good to go on those points then I recommend debugging your strategy. Typically this is done by using print statements or draw objects. I'll provide a link to our help guide for debugging: https://ninjatrader.com/support/help...script_cod.htm

                          Finally, as the print statement is not easily set up in the strategy builder (when you've not done it before), i've previous created a short video that demonstrates using the print statement in the strategy builder to output values of interest. In your specific case I suggest that you print the values used in your entry conditions to see why it is not placing entries: https://paul-ninjatrader.tinytake.co...NV8xMDk5MDc5Nw

                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            Thanks Paul,
                            There are at least 2 things I do not understand that you suggested for me to do...
                            1) Why am I setting the current state to "real time"? - what does that do for me?
                            2) Historical Data involved with the Realized PNL (see quote from you below) - perhaps I do want to turn off the Historical data, What is checking with Historical Data doing for me?
                            In the strategy builder of NT8, the "realizedPnl" would relate to the strategy only and would include any historical trades results made by the strategy (unless programmed not to make any historical trades). For example if you apply a strategy to a chart with 5 days of data loaded, the strategy will process all 5 days before connecting to real time data and will perform historical trades over that duration and the results of those trades are accumulated into the RealizedPNL of the strategy. So the RealizedPNL is the accumulated total of all trades made, historical and real time, by the strategy. It does not represent or know of any other strategy or account.


                            I think #2 is the culprit, meaning that it is looking back many days and the profit target and/or loss target over the 20 days I'm looking back is causing the bool = false condition which is keeping any trades from being initiated. I'll test that with a chart using only 1,000 bars back.

                            My goal is to compare the Realized PNL for that single session (day) and stop trading when the Session Profit Target or Session Loss Target are breached.

                            If you can comment on both #1 and #2 above I'd be most thanksfull.
                            Regards,
                            Ronnie.
                            Last edited by RonnieB; 10-15-2019, 01:40 PM.

                            Comment


                              #15
                              Hello Ronnie,

                              Thanks for your reply.

                              Checking that the state is Real time as an entry condition means that your strategy will not place any trades historically. The reason you want to do this is to meet your goal where the strategy PNL reflects only real time trades and not any of the previous (historical) days of the chart."For example if you apply a strategy to a chart with 5 days of data loaded, the strategy will process all 5 days before connecting to real time data and will perform historical trades over that duration and the results of those trades are accumulated into the RealizedPNL of the strategy. So the RealizedPNL is the accumulated total of all trades made, historical and real time, by the strategy. " Using State.Realtime as an entry condition means trades will only be made on live (or market replay) data.


                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RookieTrader, Today, 09:37 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post RookieTrader  
                              Started by alifarahani, Today, 09:40 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by Gerik, Today, 09:40 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by KennyK, 05-29-2017, 02:02 AM
                              3 responses
                              1,285 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              11 responses
                              186 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X