Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer discrepancies

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

    Strategy Analyzer discrepancies

    I'm just practicing with Strategy Analyzer, but there are some things I do not understand:

    1) the "Stategy Analyzer Summary" attachment points to significant losses of the strategy, but the "Chart" would seem the opposite, with few losing trades in no-trending moments (and reduced price differences) in comparison to the gains: how does this come?

    2) I limited trading to a normal session (displayed in my PC's European time):
    if (ToTime(Time[0]) < 143000 || ToTime(Time[0]) > 220000) return;

    that is 8:30 to 16:00 EST: why did the Strategy Analyzer chart stop at 18:15? And where can I see what happened after 18:15 ?

    3) Since summer time is different between Europe and U.S., how may I directly set time the ToTime function to U.S.time values ?
    Attached Files
    Last edited by fliesen; 04-07-2014, 05:04 AM.

    #2
    fliesen, would really suggest to step through each trade / execution done to understand what's exactly going on - it seems there's a higher # of smaller trades / reverses in there, that could easily add up and offset any of the trend gains I would think. Needs a closer analysis for sure.

    Are you connected live so any missing data for the April 4th could be downloaded for the ES 06-14? As otherwise it would just use what's locally present.

    Correct US and Europe switch to summer time on different weekends, your PC and NinjaTrader would always run off the local time zone set. You could convert hours over to US time or just setup your PC in EST for example so times for the US index ES would be dealt with natively for example.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I'm checking any single trade to understand things better. Some big losses appear at the end of the day, probably because the strategy is disabled at the time settled by the code:
      if (ToTime(Time[0]) < 93100 || ToTime(Time[0]) > 160000) return;

      so that positions eventually still open may gain or lose without control after the bell: how may I avoid this (i.e. positions running after, or opened shortly before the strategy stops) ?

      I'd also like to know how to implement my orders to market prices (for a sure filling) or to the last traded price (with possible lack of execution).

      Could you finally tell me how to calculate commissions in the strategy analyze ? I set General -> Include commissions to "true", but I don't know where commissions are to be indicated.

      Thanks in advance

      Comment


        #4
        Correct fliesen, that would not allow any logic to trigger that is following below if outside those times, the default ExitOnClose should trigger though (if you enabled this from your strategy properties).

        You can also check for a custom time to exit for example via market order, i.e.

        if (ToTime(Time[0]) >= 161000)
        {
        ExitLong();
        ExitShort()
        }

        Market Orders would be set via the EnterLong() and EnterShort() in NinjaScript's managed mode, here's more info to all types we support - http://www.ninjatrader.com/support/f...ead.php?t=3271

        To see commissions factored into backtesting, you want to ensure to have set them up for your Simulator account entry under Tools > Options > Commission
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Perfect, thank you.
          Returning to the Strategy Analyzer, I notice that many trades - very strangely - were not executed against all expectations.
          For istance, the attachments show that since 14:30 to 16:00 (London time), trades are regularly and continuously running, as it should, while thereafter only a few and very short trades took place, disregarding some strong trends that my strategy was largely to profit of.
          Before any other evaluation, it is clearly of main importance to understand why the software doesn't place (or fill) the planned orders at all.
          Can you please explain it to me or help me to understand ?
          The StochTurn strategy is also attached and is very simple: a buy or a sell market order, together with an exit from the previous opposite position, is placed whenever the orange line (a Slow Stochastic) makes a positive-to-negative or a negative-to-positive turn. This way, there always is an open position. Nevertheless, the code doesn't seem to work correctly after 16:00. Why ?
          By the way: what happens when an ExitLong or ExitLong command is routed with no open positions ?
          Attached Files

          Comment


            #6
            fliesen, ExitShort and ExitLong would then be ignored if no position existed to exit from.

            You added in to close any trade via market if time > 160000, wouln't that be rather 220000 in your timezone setup?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              You're right.
              I adjusted only one line and forgot to set the other one....
              Thanks again.

              Comment


                #8
                Sorry, but I have new questions related to the Strat, Analyzer:
                - is there a chance to display the profit/loss directly on the chart ?
                - more important, some trades do appear in the "Trades" tab, but not on the chart (see attachments): how is this possible ?
                - for a correct evaluation of the results, I have every time to load the strategy indicators on the "chart" tab. Is there no way to set the configuration of these indicators on the charts by default ?
                Attached Files

                Comment


                  #9
                  Hello Fliesen,

                  Thank you for your post.

                  To display the PnL you could enable the Chart Trader on another chart for the same instrument and account. Or use DrawText() in your code to draw the PnL on the chart: http://www.ninjatrader.com/support/h...7/drawtext.htm

                  Are you viewing the fourth on the chart? Even the three executions I see on the chart are not on the Trades tab. Scroll down on the Trades tab do you see these executions?

                  You could use a Chart Template to assign specific indicators with specific settings to your charts: http://www.ninjatrader.com/support/h..._templates.htm

                  Comment


                    #10
                    Thank you.

                    1a) How do I enable the Chart Trader ?

                    1b) If the code line is
                    DrawText(string text, int barsAgo, Color color)
                    how must I define PnL instead of "text" ?

                    2) With regard to this, there is something even stranger. Although I'm backtesting one only day as timeframe (from 04/04/2014 to 04/04/2014, Session Template 24/5), both the chart and the trades tabs show data for TWO days (April 4th and 3rd, as in the first attachments). Same thing (= TWO days) when testing the timeframe of one month (attachment "1 month chart"). Why ??

                    3) I know that I may use a Chart Template. However, may I get it already displayed whenever I open the chart tab of the Strat.Analyzer, without having any time to add the same indicator ?
                    Attached Files
                    Last edited by fliesen; 04-14-2014, 10:02 AM.

                    Comment


                      #11
                      Hello fliesen,

                      Thank you for your post.

                      To enable the Chart Trader, right click in your chart > select Properties > set the property 'Show Chart Trader' to True > OK.

                      The DrawText() method would be DrawText("Unrealized PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency).ToString(), 0, Color.Black);.

                      The Default 24/5 is set to 12 AM EDT to 12 AM EDT, if you are in another time zone it will include a previous or following day.

                      You would have to right click in the Chart tab and select Templates, it will not automatically load.

                      Comment


                        #12
                        Thank you.

                        Just for the point 1b), when I implement the line

                        DrawText("P/L: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency).ToString(), 0, Color.Black);

                        I get the error message "No DrawText overload accepts 3 arguments", so which one(s) may I remove ?
                        Attached Files

                        Comment


                          #13
                          Hello fliesen,

                          Thank you for your response.

                          We would need to include the 'tag' which I did not in my previous post. Please use the example below and use a different 'tag' for each DrawText:
                          Code:
                          DrawText("pnlTag", "Unrealized PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency).ToString(), 0, Color.Black);

                          Comment


                            #14
                            Sorry, it doesn't work either.
                            May I send you the whole code ?
                            Attached Files
                            Last edited by fliesen; 04-15-2014, 01:46 AM.

                            Comment


                              #15
                              Hello fliesen,

                              Thank you for your response.

                              The DrawText() method will require a Y value for the placement of the text. I added the Close[0] to the DrawText() methods and the indicator compiled. The first DrawText was as follows:
                              Code:
                              DrawText("PnLTag1", "Unrealized PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency).ToString(), 0, Close[0], Color.Black);
                              You may wish to instead use the DrawTextFixed() method to keep the PnL displayed at a fixed point on the chart, rather than drawn at a certain bar: http://www.ninjatrader.com/support/h...wtextfixed.htm

                              Please let me know if I may be of further assistance.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              15 responses
                              3,271 views
                              0 likes
                              Last Post xiinteractive  
                              Started by Tim-c, Today, 02:10 PM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Taddypole, Today, 02:47 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post Taddypole  
                              Started by chbruno, 04-24-2024, 04:10 PM
                              4 responses
                              51 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              10 responses
                              403 views
                              1 like
                              Last Post beobast
                              by beobast
                               
                              Working...
                              X