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

Not getting the right time

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

    Not getting the right time

    Hi NT forum,

    I'm having an issue with the strategy analyser.

    I back-tested one of my strategies and it gives me the resulting distribution based on hours, as you can see in the image.

    The thing is that, I'm not able to run a backtest on only those hours that I have in the distribution graph. Are they cumulative hours? Time? ...

    More details about this: I'm based in Spain, so my hour is Brussels time (UTC +1). I'm backtesting into NASDAQ without exiting on the close of the session.

    So, which session manager template should I create to backtest the strategy in those hours that are listed in the attached file?

    Please, if you could help me, it will be very appreciated.
    Attached Files

    #2
    Hello,

    Thank you for the question.

    The graph you have shown is an Hourly graph, meaning the X axis is scaled to hourly, so the information you are viewing would be grouped by the hour it was exited per the settings in the toolbar. This could include quite a few different trades as this is based on exit times and appears to be an instrument with a 24 hour session.

    As far as limiting the trades to these hours, you could either adjust the trading hours to reflect the hours you want or you could add a Time filter to your strategy. Adding a time filter would be my suggestion as this prevents the need to edit the session template in case you want to still view the full hours on a chart.

    We have some simple examples of time filters in the following links:




    The times you see on the chart would relate to the converted times you see in the platform, if you wanted to limit a time range on the strategy based on the hours you see in the analyzer, you could use those hours directly for the timespan in your code.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      We have no coding experience and the strategy was made with the Wizard.

      Could you please set and show how you would put the code or the Session Manager to make the backtesting in those hours?

      The details are:

      Instruments used: NQ
      Hours: the ones that we see in the graph.
      Time in my PC: UTC+1

      Thank you in advance,

      Comment


        #4
        Hello,

        Thank you for the reply.

        The wizard can still be used to create time conditions. In a condition set, you could use the following approach to define a time condition.

        Left Column: Time -> Time Series -> 0 bars ago
        Center Column: >=
        Right Column: Time -> Time Value and enter a start time
        Add a second condition to the same set.

        Left Column: Time -> Time Series -> 0 bars ago
        Center Column: <=
        Right Column: Time -> Time Value and enter a end time
        You could repeat this for each set where you want a time filter.

        To learn more about editing or creating sessions, please see the following help information: https://ninjatrader.com/support/help...on_manager.htm

        The hours you see in the session manager would be the actual sessions hours in the timezone of the exchange, after modifying the hours you could pull up a chart to see the changes. I would suggest doing this and then reload historical data in case you change sessions.

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

        Comment


          #5
          Okey Jesse.

          I will go through it and see if I can do it.

          I will contact you if I'm finding any problem.

          Thanks a lot,

          Comment


            #6
            Hi Jesse,

            I’m not able to get the back testing results of those hours in the graph.

            Are those hours grouped independently of the time zone? I mean: 01:00 means the first our of the session, 02:00 the second hour.. and not 01:00 UTC Time???

            Please, how could you do it with the setting I detailed you,

            Im based in Spain (UTC +1). And the graph you are seeing if the Nasdaq E mini (NQ), with the settings that you can see in the attached snapshot. How could I do it?


            ***The thing is to understand (tell me please) in words what is saying that graph to us, with that specific distribution. It is clear that something can be exploited.


            If you could help me it would be great,
            Last edited by EZarate; 11-04-2017, 05:46 AM.

            Comment


              #7
              Hello,

              Thank you for the reply.

              Let's look at a more simple example of how the graph displays data using an instrument that has a single day session first. Looking at AAPL which has a session of 9:30 am - 4:00 pm Eastern time we can see how the hours on this graph are listed.

              For this test, I am 2 hours behind eastern time, so if I want to convert a time from the chart to the exchange time it would be the time plus 2 hours. The time on the graph will be already converted to your local time so you don't need to do any conversions. For example, the open of AAPL is at 9:30am which is 7:30 my time so my distribution chart starts at 7:30am.

              If I were to run the strategy and then view the distribution I should see trades distributed over the hours of 7:30 am - 14:00 as this is converted to my local time. The times the strategy will see will be these converted times, so if you want to know what time you should set a condition for, you would use the time you see on the chart. You can also have the strategy output the Times it sees to further explore this question by using Prints like the following:
              Code:
              Print(Time[0]);
              Because the session of this instrument is nearly 24 hours, it would be more difficult to read as the span is overnight. The start time of the instruments session would still relate to the instruments settings, so the NQ would still start at 5pm central time.

              The charts hours will span 24 hours so it would start at 0:00 and end with 24:00, this means that the day the trade was placed would depend if they are before or after the session break, and then the hour listed would be what the platform sees as the converted local time. These times should be able to be used in the strategy conditions. To confirm what the strategy sees for times you can use a Print statement.


              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Mindset, 05-06-2023, 09:03 PM
              9 responses
              258 views
              0 likes
              Last Post ender_wiggum  
              Started by Mizzouman1, Today, 07:35 AM
              4 responses
              18 views
              0 likes
              Last Post Mizzouman1  
              Started by philmg, Today, 01:17 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by cre8able, Today, 01:01 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by manitshah915, Today, 12:59 PM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X