Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multitime frame strategy - data problem

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

    Multitime frame strategy - data problem

    Hi,

    I am running a strategy using: -

    - FESX 03-14 contract. 1 minute bar.
    - FESX 03-14 contract. 1 dayly bar.

    I have ran it using my Sim101 account and real data and there is something wrong I cannot understand. My strategies can open positions in the first/second bar from 1 minute bar chart based on SAR, WMA, CLOSE and HIGH from the last dayly chart session (calculated at Close session). Unfortunately it worked perfectly using historical data but it is a disaster using real time data.

    I have debug my code using the next code:

    if (CurrentBar < 30)
    {
    Print(
    "Bar number" + CurrentBar);
    Print(
    "Open session value" + OpenSession);
    Print(
    "SAR value" + ParabolicSAR(BarsArray[1], 0.02,0.2,0.02)[0]);
    Print(
    "WMA value" + WMA(BarsArray[1], periodo)[0]);

    in order to print SAR, WMA values for the last session. I was asthonised when I checked out that strategy get Open session value right, but SAR and WMA have different values for each bar at the beggining of session (10-15 bars aprox.). Because SAR and WMA were taken from previous session dayly chart they MUST BE A FIXED NUMBER for the whole next session. Does anyone experience a similar problema or know how to fix it?

    Instrument "1" is FESX dayly chart. Thanks in advance,

    Fernando

    #2
    Who is your data provider? It's possible the Daily bars could be based off of ETH or RTH hours where as the minute bars may be the opposite.

    Look forward to assisting you further.
    LanceNinjaTrader Customer Service

    Comment


      #3
      My data provider is TT. Excuse me, but I don´t understand what you mean by ETR or RTH. Apparantely, both charts are build ok and dayly values for indicators are coherent with Kinetic one.

      Thanks,

      Fernando

      Comment


        #4
        ETH stands for Electronic trading hours (includes the overnight session)
        RTH stands for Regular trading hours (pit session)

        Who are you using for your historical data?
        What are all the connections you have open on the bottom left of the control center?
        LanceNinjaTrader Customer Service

        Comment


          #5
          Hi Lance,

          Thanks for the explanation.

          - The only connection I have activated is TradingTechnologies.
          - For historical data I used Zenfire. I guess you referred to data used in my backtests.

          I may not make me understand. Main instrument is FESX 1 minute bar and I ask my strategy that every OnBarUpdate (aka every 1 minute) compares last sessión values for WMA and SAR ON dayly chart WITH Close, open or whatever IN CURRENT 1 MINUTE BAR. The problema is WMA AND SAR values are different on each OnBarUpdate, which is a nonsese because that values are attached to last day sesión (already closed) and MUST BE CONSTANT. Excuse me for the mess....

          Thanks Fernando

          Comment


            #6
            Thank you for that information. As TT typically doesn't provide historical chart data I'm wondering if the issue your seeing is caused by missing data or an issue in the strategy logic.

            When you manually open up a chart to FESX 1 minute, are you able to right click on the chart and select Reload historical data, or is this grayed out?
            LanceNinjaTrader Customer Service

            Comment


              #7
              Hi Lance,

              Have just checked it. And it is GRAYED OUT. Is anything wrong about TT?. If so, I purchase Kinetic will I avoid it?.

              Thanks,

              Fernando

              Comment


                #8
                Thank you for that information. Nothing is wrong with TT as this is expected. When running an automated strategy typically you will be required to have historical trade data. Using Kinetick in conjunction with TT would allow you to route your orders to your broker (through TT) and get your real time data from Kinetick.

                For a list of all our data providers and what they provide: http://www.ninjatrader.com/support/h...rical_data.htm

                Kinetick: http://www.kinetick.com/
                LanceNinjaTrader Customer Service

                Comment


                  #9
                  Hi Lance,

                  Thanks for your time. Just to confirm, if I understand well. You mean that because TT do not provide historical trade data, SAR, WMA and other variables cannot have proper values in the first bars of sessión. Is it right?. Solution is to add a new connection from the list you linked. However on my dayly/1 minute charts I have loaded many historical bars, as back as one year for dayly chart and five days for 1 minute bar?.
                  Are these data available to be used by strategies or they need to be provided by a real time connection like Kinetic?. It is something I would like to understand for better Ninja comprehension.
                  In Brief, the only solution is to add a new connection.


                  Best regards,

                  Fernando

                  Comment


                    #10
                    If you're backtest values are correct then yes this would be my first guess. However I would need to know more about the complete script to give you an accurate answer.

                    My first question is, how have you loaded this much historical data?

                    If it's been obtained by real time information then there is a strong chance data is missing. Depending on the script it might be possible to use the Kinetick EOD free data for daily bars and run in real time off of the minute data from TT as it comes in. That being said, any connection losses would cause this data to become incomplete. When running a strategy that looks at past data it is strongly recommended to use a data provider such as Kinetick that gives complete historical data.
                    LanceNinjaTrader Customer Service

                    Comment


                      #11
                      Hi Lance,

                      Some comments:

                      1) Dayly chart historical data is built from Kinetic EOD (Kinetic free connection) and 1 minute bar is from TT. And yes, one minute chart may be incomplete.

                      2) Backtest value were rigth. I checked some of them manually.

                      3) I just look for past dayly data (WMA , SAR at close Price from last sesión). For this reason I guessed it would be enough Kinetic EOD and TT.and I thought never mind I have 1 minute bar chart complete

                      4) About strategy code. I have one question. I read ninja Help about building bars in multitime frame instruments and if I understand well.:

                      ParabolicSAR(BarsArray[1], 0.02,0.2,0.02)[0]);

                      This code means that once market opens. Strategy will search for instrument 1 (aka dayly bar) parabollic Sar value at close in yesterday´s session. I mean index[0] WILL REFER TO DAY BEFORE NOT TO CURRENT SESSION.

                      Regards,

                      Fernando

                      Comment


                        #12
                        Originally posted by azunal View Post
                        This code means that once market opens. Strategy will search for instrument 1 (aka dayly bar) parabollic Sar value at close in yesterday´s session. I mean index[0] WILL REFER TO DAY BEFORE NOT TO CURRENT SESSION.

                        Regards,

                        Fernando
                        This is correct, assuming Calculate On Bar close is set to true.

                        Based on what I've heard I think it might be possible to use the Kinetick End of Day connection to first connect and download the historical data bars, then disconnect and connect to TT. This should work as long as your strategy doesn't rely on minute data calculations.

                        As a test you can sign up for a 7 day trial to IQFeed here: https://www.iqfeed.net/NinjaTrader/i...ayaction=start
                        This would allow you to see if the issue is caused by the data or the script logic.

                        Connect to IQ first and then TT.

                        I strongly suggest you continue to do any testing with the SIM101 account.
                        LanceNinjaTrader Customer Service

                        Comment


                          #13
                          "Based on what I've heard I think it might be possible to use the Kinetick End of Day connection to first connect and download the historical data bars, then disconnect and connect to TT. This should work as long as your strategy doesn't rely on minute data calculations"

                          Hi Lance,

                          Calculate on bar close is set to true, I have tried to do what you mentioned about connecting first Kinetic, download historical data....but apparently it does not work.

                          Thank you very much for IQFEED. free trial. I will try it. I am also having many problems with my TT connection because it rejects FESX contract as "unknown instrument" and IQFEED wlll help me.

                          I attached you a Little piece of code to check if there is a one minute calcultaion in bars that could be wrong for Ninja.

                          if ((Bars.FirstBarOfSession) && (BarsInProgress == 0))
                          {
                          Apertura = Opens[0][0];

                          and

                          if (Lows[1][0] <= Apertura)
                          {
                          Minimo = Math.Max(Apertura*(1 - porcentaje1/10000.0), Lows[1][0] - puntos)

                          This is basically what the code does. Do you think a simple comparation could make wrong my strategy?.

                          Fernando

                          Comment


                            #14
                            if (Lows[1][0] <= Apertura)
                            {
                            Minimo = Math.Max(Apertura*(1 - porcentaje1/10000.0), Lows[1][0] - puntos)
                            I don't see anything fundamentally wrong with the code here. However it is typically good form to ensure you bracket your different BarsInProgress. You might be doing this already but I just wanted to make sure.

                            Let me know what you find when using the historical data connection.

                            In regards to TT mapping errors if you contact your broker they will be able to give you the correct mapping. If you need help adding these let me know.
                            LanceNinjaTrader Customer Service

                            Comment


                              #15
                              Hello Lance,

                              I have been debugging my strategy for the weekend founding rather incoherents results:

                              - For market replay and historical data strategies did well. Using the correct values for indicators (WMA and Parabollic SAR) and stoplosses.
                              - However, on real data there is a complete mess. My strategy Works as follows; After the first bar of session it decides wheter to trade or not based on Close, high and low from last session DAILY FESX chart and current session open. After printing in the output window those values after the first bar in REAL TIME they are ALL right. But...for indicators (I use WMA and parabollic SAR based on last session close in daily FESX chart) the values for them ARE COMPLETELY wrong and has nothing to do with previous sessions, 1 minute FESX chart or VALUES SHOWN IN DAILY CHART DATA BOX., I also printed these values in output window and checked them out. It also seems that these values (that are constant) vary for the first 4-5 bars of session for some sessions.

                              For me, there are three potential problems:

                              1) A message in log Tab: "Market request data was rejected: Unknown instrument "FESX 03-14" that appears every day which first tick of session. However chart is built fine in real time and strategies trade despite of that error (using wrong values). Brandon frorn NinjaTrader is trying to solve it but until now...it has been imposible.
                              2) The work our Trading technologies connection Works. TT does not offer WMA and SAR values at the end of session as Kinetic or other providers with no restarting and non-stop connections. It restart every day and do not show those values until first tick of session. Also is not available for weekends
                              3) Something wrong with TT technologies configuration.

                              I am trying to run a simple a strategy for almost a month, which is quite frustrating. Do you think if I change to Kinetic I will avoid all that problems?.

                              Thanks in advance.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by junkone, Today, 11:37 AM
                              2 responses
                              14 views
                              0 likes
                              Last Post junkone
                              by junkone
                               
                              Started by frankthearm, Yesterday, 09:08 AM
                              12 responses
                              44 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by quantismo, 04-17-2024, 05:13 PM
                              5 responses
                              35 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by proptrade13, Today, 11:06 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by love2code2trade, 04-17-2024, 01:45 PM
                              4 responses
                              35 views
                              0 likes
                              Last Post love2code2trade  
                              Working...
                              X