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

Undesired strategy analyzer behavior auto-closing position at end of test period

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

    Undesired strategy analyzer behavior auto-closing position at end of test period

    Is there a way to set it so that an open position at the end of a test period is ignored rather than closed? I do not want this open position to count as a trade.

    Thank you

    #2
    Hello digibob,

    I'm not aware of a way to do this.

    I will submit a feature request on your behalf for the NinjaTrader Development to consider this.

    Once I have a tracking ID I will post in this thread for future reference.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Oh, OK. Thanks Chelsea.

      Comment


        #4
        Hello digibob,

        I have received tracking ID# SFT-2051 for this request for the last open position entry order to be ignored.

        Please note it is up to the NinjaTrader Development to decide if or when any request will be implemented.

        We appreciate your feedback.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello digibob,

          I have received tracking ID# SFT-2051 for this request for the last open position entry order to be ignored.

          Please note it is up to the NinjaTrader Development to decide if or when any request will be implemented.

          We appreciate your feedback.
          Actually what I want is similar. It's fine for my strategy to end in a long position.

          It would be great if you could create the following additional tabs for setting up the strategy prior to beginning...

          On the Settings. Create a new setting under Order handling.

          Allow strategy to end in long position - check (or just assume this if the Exit on session close is left unchecked, if the Exit on session close is left unchecked, noone on earth would ever liquidate every position arbitrarily anyway, however if you want to leave this ability intact then just add the new option)

          Starting Position list. Instrument, Quantity, Price, Time, Stop Limit, Sell Limit. (so these positions can be disposed of within the strategy, allow for multiple Positions per instrument of course because the strategy may allow that)

          On the Display drop down add a new page

          Ending Positions. (Post Run, with normal position metrics, this of course will be empty if either "Allow Strategy to end in long position" or "Exit on Session close" is checked).

          On Analysis page

          Add a line that shows the "Unrealized Profit/Loss" based on the ending positions. These amounts should be excluded form all of the other metrics on the Analysis since they are not completed "trades". It would also be handy to show the "Starting Unrealized Profit/Loss" at the start of the strategy based on the market price of the first tick compared with the Starting Positions. You can show an additional metric of the "Strategy Unrealized Profit/Loss" as the difference between the "Starting Unrealized Profit/Loss" and the "Unrealized Profit/Loss" which is essentially the unrealized profit/loss that was accumulated during the analysis.

          On the Trades tab they won't show because they are "unrealized". They consequently should not affect any of the analysis results. ie. profit, etc. since they aren't finished yet.

          The final long purchases can still show on the Executions tab.

          This is actually quite easy to implement I believe having worked extensively now with the framework and the object library.
          Last edited by jrstokka; 10-02-2019, 06:21 AM. Reason: I suspect this is also what digibob really wants... :)

          Comment


            #6
            Hello jrstokka,

            When you mention:

            "Starting Position list. Instrument, Quantity, Price, Time, Stop Limit, Sell Limit. (so these positions can be disposed of within the strategy, allow for multiple Positions per instrument of course because the strategy may allow that)"

            Orders cannot be placed from the parameters. The Instrument and Default Quantity can already be set in the strategy parameters.

            When you mention:
            "On the Display drop down add a new page
            Ending Positions. (Post Run, with normal position metrics, this of course will be empty if either "Allow Strategy to end in long position" or "Exit on Session close" is checked)."

            The ending position will always be flat. However, the Executions display will let you know for every order what the position was taken to.

            When you mention:
            "On Analysis page
            Add a line that shows the "Unrealized Profit/Loss" based on the ending positions. "

            Are you wanting this line shown on the Cumulative Net Profit graph?
            Would this be a line from the total profit on the right of the chart that extends to the left?


            Only fully closed trades with an entry and an exit can be included with the performance.

            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea,

              Thanks for the quick response.

              OK. Regarding the Starting Position. If presume you can you can just "push" the Position List into the Positions database upon strategy execution with the appropriate information such as Price, Date, etc. As if the trades executed in history within the strategy on the startingPosition.Date with an EnterLong(startingPosition.Qty, And of course assuming that the strategy would not have normally closed them out prior to the beginning.

              Ignore what I said about the StopLimit as it will be handled internally by the strategy. I can see why this was confusing. I was under the impression that each open Position in the strategy carried along it's own StopLoss and ProfitTarget that were in effect at the time the Position was entered but that doesn't appear to be the case. It seems to be more of a point in time setting that applies to all of the Positions within the strategy. Although i don't really understand that because when you EnterLongStop you can specify an exit stop price so that seems to make it variable according to individual Positions so if that's the case then you should be able to push them as I originally suggested. You have to be the judge on that.

              The ending position will not always be flat if you implement my suggestions. Because some of the positions will still be open when the strategy finishes. That's the whole point.

              Essentially I'm trying to create in the Analyzer a strategy that can begin AND end with Open Positions (Long in my case). A similar concept could be used I'm sure for short positions but I don't trade that way so it's irrelevant to me. But if that were the case I can imagine a Line on the analysis that showed "Ending Position Totals" of both "Long and Short and a summation showing total exposure on the Summary (%) page. I can imagine that would be pretty cool for traders that keep short positions overnight. Traders with much more intestinal fortitude than I have

              When you ask... "Are you wanting this line shown on the Cumulative Net Profit graph?"

              The answer is no. I want it to show on the Summary (%) page That was my mistake.

              When you ask... "Would this be a line from the total profit on the right of the chart that extends to the left?"

              The answer is no. Don't make any changes to the Analysis Graph. It's essentially just a summation of everything in the "Trades" dropdown, which are both "entry/exit" pairs.

              When you say... "Only fully closed trades with an entry and an exit can be included with the performance."

              I completely agree. What I want to do is prohibit the final "trades" from closing by virtue of the strategy ending. I want the Positions to be left open for analysis on backtesting AND even in a live environment I can imagine that I would want the option to deal with open positions manually. I would not just want to dump everything at the market because I was stopping the strategy. I would want to dispose of them manually as I saw fit.

              Comment


                #8
                Hello jrstokka,

                The point of the Strategy Analyzer is to generate performance based on trades using historical data.
                The performance of an open position cannot be included.
                The Strategy Analyzer will not run a strategy in real-time and cannot leave an open position.

                There is a feature request to exclude the last open trade instead of forcing it closed.

                I will, however, submit your request to leave an open position and report the position that is left open.

                Once I have a tracking ID for this request I will post in this thread.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello jrstokka,

                  I have received tracking ID# SFT-149, for this request to leave an open position at the end of the test and report the open position.

                  Please note it is up to the NinjaTrader Development to decide if and when any request will be implemented.

                  We appreciate your feedback.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by techgetgame, Today, 11:42 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post techgetgame  
                  Started by sephichapdson, Today, 11:36 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post sephichapdson  
                  Started by bortz, 11-06-2023, 08:04 AM
                  47 responses
                  1,612 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
                   
                  Working...
                  X