Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Has anyone run some backtests/optimizations in the Strategy Analyzer

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

    #16
    On a separate note, I can't find an appropriate combination of
    "From" and "To" entries under "TimeFrame" to generate results for
    a single day on intraday data series. For example, if you set:
    From 11/3 to 11/3 you get trades for both 11/3 and 11/4.
    You might want to expand the From/To entries to include minutes
    (11/3/09 12:00 am - 11/3/09 11:59 pm ?)

    Comment


      #17
      The dates are controlled by the session template you choose to use in your backtest. If you want 24 hour session please select 24/7 or 24/5 for the session templates.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        Well, I tried various templates beyond the one that was
        set for the instrument ("Forex"). When I set From and To
        to 11/3/09 I still get All trades that exited on the 3rd and 4th.
        I guess this is a suggestion to incorporate minutes in the
        From/To entries.

        Also, is there a way to track real PnL intraday?
        I'm using Perfromance.AllTrades.TradesPerfromance.Currency.C umProfit
        but this assigns PnL of trades at their exit bar. For real time PnL
        we would need to track CumulativePosition and AverageEntryPrice
        for Shorts/Longs of all signals in the script and marktomarket at every bar.

        Thanks,

        Comment


          #19
          Not sure what you mean. If you are using intraday data you will get timestamps of minutes and even seconds if your data has seconds granularity.

          If you want to track real trades use Performance.Realtrades.
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Wasn't clear. Even for Historical trades,
            Performance.AllTrades.... assigns the whole PnL at the
            DateTime where the Exit of the Trade is stamped.
            So you can't track the PnL resolution intraday .

            Another way would be to track PnL on a bar to bar basis
            by accessing the Cumulative Long/Short position and their
            corresponding average prices as they are adjusted with every
            execution, and marktomarket at every bar intraday.

            Comment


              #21
              Correct. Performance is a measure of your overall trading. If you want individual trades you need to be looking at the Trade class.
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                From the examples I see the Trades collection refers to Completed
                trades. Is there any way to track PnL (i.e., M2M at each bar)
                while the Trade is open, even on Historical data?

                That is, you might have several trades generated during the day
                (let's say beggining session to end session) but
                they all exit at close of market. Can you track the M2M at intraday granularity (so you know what's your PnL at 12:00 pm-even thogh there
                where no exits till that time)? Also, to apply these on backtests (historical data).

                Comment


                  #23
                  You can try: http://www.ninjatrader-support.com/H...rofitLoss.html

                  If you need even more granularity you need to track it yourself based on your IOrder's filled price.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by dnoff View Post
                    I have tried running the optimizer several times tonight and it constantly fails to run beyond the a few seconds and throws the following errors:

                    11/1/2009 8:13:48 PM Default Error on running optimizer: Value cannot be null.
                    Parameter name: value
                    11/1/2009 8:14:00 PM Strategy Error in setting strategy parameters: Input string was not in a correct format.

                    The settings I am trying to optimize can be run successfully in 6.5 (just takes a while), and I enter the values (checked several times) by expanding the parameters and typing the values into the boxes.

                    Thoughts
                    So I have been playing with the optimizer this afternoon and the issue I noted above is still present. It is however only present with the "default" optimizer, not the newer genetic optimizer.

                    So I have attached the screen shots of the strategy I have been running to optimize. It fails with the error1 first, and then error2 (screen shots). I checked the trace file and their is not errors at all in there, just entries getting data from Zenfire.

                    If I switch the optimizer from "default" to "genetic", it runs to completion.

                    Note: I am on NT 7.0.0.4, Win 7-x64

                    I can send the strategy if required - let me know.
                    Attached Files

                    Comment


                      #25
                      What data type is "EntryType" and "ExitType"? It needed to be string/int/double/bool. Any other data type if not supported.

                      Comment


                        #26
                        Originally posted by NinjaTrader_Dierk View Post
                        What data type is "EntryType" and "ExitType"? It needed to be string/int/double/bool. Any other data type if not supported.
                        It is a custom enumeration of strings/values. I suspect this is the problem then. Is this new/changed from 6.5 as this strategy used to work just fine in this. Also, why would the genetic optimizer still work?

                        Thanks for the reply

                        Comment


                          #27
                          We only ever supported string/bool/int/double for strategy parameters (see strategy analyzer). I may or may not have worked in 6.5.

                          Comment


                            #28
                            "You can try: http://www.ninjatrader-support.com/H...rofitLoss.html"

                            The above is for Unrealized PnL
                            Is there sthg tracking Realized PnL?

                            Thanks,

                            Comment


                              #29
                              That's what the Performance and TradeCollection classes track. I am not sure what you are trying to get since you started from there to begin with.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #30
                                Well basically, I'm trying to do marktomarket at every bar intraday
                                for a case with multiple signals.

                                Position.GetProfitLoss(Close[0], PerformanceUnit.Currency)

                                tracks unrealized Pnl. The issue is that at a given intraday bar you might have some trade closing while others are still open.

                                As I understand, when a trade closes
                                Performance.AllTrades.TradesPerformance.Currency.C umProfit

                                i.e, RealizedPnL is updated.
                                Last edited by trend; 11-06-2009, 03:49 PM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                626 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                359 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                105 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                562 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                567 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X