Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trades not adding up

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

    Trades not adding up

    I have been noticing day after day my trades are not being the same on the live account as it is with market replay. I run the same exact strategy, against the same exact stocks, but some time on the real account an entry signal is not generated that is generated on market replay when I replay the day...

    This is not an issue of order handling and the order just not being transmitted or something, instead it seems the values of the indicators the strategy relies on must not be the same so therefore a trade is never triggered to begin with..

    Attached are 2 screenshots, one from the real account and one from the fake account showing that most of the trades are the same except for slippage and other small factors.. what is concerning is the trades that NEVER fired off on the real account...

    What can possibly be going on? BTW I checked the logs for the times around the missing trades, nothing in the logs.. so this is not an issue with the order not being filled or transmitted.. it was flat out NEVER generated..

    If you notice some of the trades line up at the right time, but some of the trades are a little later.. Since some of the trades were almost at the IDENTICAL time, makes me think the tick bars were generated at the right time... but that some of the indicators used have different values between replay and live... Some of the indicators used have EMA averages, such as MACD and MFI.. if that could possibly explain this...

    Please help me figure this out, as I am very confused and concerned when there is this much variation between replay and live. I can live with slippage and other small factors but MANY trades not even being taken is really messing with my results..



    #2
    Even more concerning is this... My strategy uses the NYSE-AD line as part of its decision making. I am wondering if perhaps this is causing the problem. I did a test just now where I ran the same startegy against same instrument. The only thing I changed is in the first run of the strategy I put min bars requried as 20 when setting up the strategy. In the second go I put min bars = 1.

    the difference was insane and made no sense. I had it print out the time and the value of that AD line and this is what I saw:

    EDIT: This strategy was run against RIMM, with ^AD as being a second instrument required. I printed the values below like this:

    Print("Time: "+this.Time[0]+" AD Line: "+Closes[1][0]);

    //Min 1 bar
    Time: 5/26/2009 8:30:57 AM AD Line: -333
    Time: 5/26/2009 8:31:40 AM AD Line: -569
    Time: 5/26/2009 8:32:23 AM AD Line: -569
    Time: 5/26/2009 8:33:00 AM AD Line: -569
    Time: 5/26/2009 8:33:41 AM AD Line: -876
    Time: 5/26/2009 8:34:24 AM AD Line: -913
    Time: 5/26/2009 8:35:21 AM AD Line: -913
    Time: 5/26/2009 8:35:58 AM AD Line: -885

    //min 20 bars

    Time: 5/26/2009 8:30:57 AM AD Line: -333
    Time: 5/26/2009 8:31:40 AM AD Line: -569
    Time: 5/26/2009 8:32:23 AM AD Line: -569
    Time: 5/26/2009 8:33:00 AM AD Line: -569
    Time: 5/26/2009 8:33:41 AM AD Line: -569
    Time: 5/26/2009 8:34:24 AM AD Line: -569
    Time: 5/26/2009 8:35:21 AM AD Line: -569
    Time: 5/26/2009 8:35:58 AM AD Line: -569

    Notice how initially the values are the same, then all of a sudden it gets hung where the AD line is no longer refreshes? But the one with min 1 bar does not hang here. What is going on? If anything I would expect the FIRST bars to be different, but instead the first few bars are the same its the later bars that are different..

    In market replay and in live trading i have always just used the default min 20 bars, but after seeing this I am wondering if perhaps during real time this value is messing up and is different than in market replay thus the different results...

    Need some help here as I am getting really concerned about NinjaTrader stability for my strategies... Am I doing something wrong? I hope so...
    Last edited by frostengine; 05-26-2009, 08:17 PM.

    Comment


      #3
      Another problem. I just pulled up a chart of ^AD from today and it appears as if after 8:58 central this morning nothing else showed up on the chart. BUT I remember watching the market analyzer I had running with ^AD as one of the symbols on it, and ^AD value was changing all day.. I used it to help make decisions for some discretionary trades.. so the values were in fact changing..

      Why didn't the values get recorded then?

      Comment


        #4
        Hello frostengine,

        First, am I correct you refer to automated strategies that make use of ATM strategies or are you referring to ATM strategies only?

        If trades are not triggered by your automated strategy and there are no errors in the log file, it indicates the conditions were not met to trigger an order.

        As per the screenshots, it seems some instruments that your strategy is running on, do not generate orders at all (DD). Is this correct?

        Check if the data used in real-time is the same as the data used in the Market Replay.

        Using a different value for 'min bars required' will result in a different outcome, since one session can only trigger orders after 20 bars, while the other session can trigger already after 1 bar.

        Ensure the exact same settings are used during real-time and the Market Replay session.

        Please right click on the Market Replay control and select 'Available master instruments' and check if you have recorded ^AD data after 8:58.
        JasonNinjaTrader Customer Service

        Comment


          #5
          Jason,

          Yes it is only automated strategies. The settings are identical between real time and market replay. The settings for both real and market replay for ALL the stocks being traded by the strategy have been: 100 tick, start at 8:30, end 2:45, min required bars 20. There was nothing different between market replay and real time as far as the settings setting up the strategy. In fact the settings from in the morning when I set up the strategy to run live gets saved unless I close ninjatrader. So when I started the strategy in the afternoon for market replay those same settings were already filled in, but I always double check to be sure before running the replay.

          Yes some stocks DD and RIMM for instance had no trades generated on real time, but did have trades generated on market replay.

          Concerning different values for min bars required. I figured this would have some affect, what I didn't really understand is how the values of the second instrument be the same for the first few bars, and then get different. If anything I would have imagined the first few bars being different with perhaps the remaining bars being the same, not the other way around.

          I am unsure where this "available master instruments" button is you mention. However, I did run the market replay with market analyzer up and running and after 8:58 the value never changes. Which is odd because in real time trading I remember distinctly those values changing throughout the whole day. So for some reason recording on that instrument only must have stopped, because I have data on ALL the other instruments for the entire day.

          Comment


            #6
            Hello frostengine,

            I suggest to check if the data used during the real-time session is exactly the same as per the Market Replay session. Could it be the strategy running on DD and RIMM in real-time never had its conditions met?

            My apologies for the typo, it should have been 'Available instruments'. Right click on the Market Replay control and select 'Available instruments' to check the times you have recorded data.
            JasonNinjaTrader Customer Service

            Comment


              #7
              Jason,

              I assume the reason the trades did not match up is because some conditions were not met. However, how can this be? Shouldn't the data recorded be the same as what it saw in realtime? How can I tell if this is the case?

              I checked available instruments and this is what it said for ^AD
              ^AD 8:30:16 AM 3:05:16 PM

              So, I assume it believed it recorded data until the end of the day.. however after 8:58 there are NO new ticks. I saw this by running a 1 tick chart of ^AD, all ticks stopped after that time.

              Comment


                #8
                Hello frostengine,

                Could it be you modified the Market Replay trend slider when runnning the session?

                Please tell me what data feed provider you are connected to when running your strategy and recording data.

                Did you re-connect to your data feed since yesterday, which would load the DD and RIMM charts with historical data from your data feed provider? If not, please try to avoid this for now. Open up a new DD and RIMM chart without being connected and it should display the real-time data from yesterday's session. Check if this data resembles the data when running the Market Replay. Unfortunately I do not see another way to check the data; I admit it will be difficult to check the data this way, since you cannot have both charts opened at the same time.

                I am not sure why the price changes were not recorded yesterday. Is there anything unusual reflected in your log file for yesterday around 8:58 AM?
                JasonNinjaTrader Customer Service

                Comment


                  #9
                  Jason, no I did not modify anything while running the session.

                  I did not reconnect the datafeed yesterday. Although I have reconnected it today to run live again. However, my data provider is IB. Which that in itself rules out it reloading historical data. Because I am using tick data and you can not back fill tick data with IB and NinjaTrader.

                  Concerning the log file. Nope, nothing unusual in there around that time.

                  This morning before turning ninjatrader on to run live I coppied all of the data files Ninjatrader.mbd and everything in /data for the market replay. So, I will run ninjatrader on a seperate box and do what you said about pulling up a chart for yesterday for those symbols and then do market replay and pull up a chart and see if I can see any noticeable differences.

                  The one runing live today I have added several Print statements to my strategy to print to the output window. It is printing the first 25 bars recorded today as well as some output statements as it goes through decision making on potential trades. If the trades don't match again today I will be able to use that output combined with what market replay outputs when the strategy is run to hopefully narrow down potentially what is going on.

                  Comment


                    #10
                    Let me know the outcome of the test. Make sure upon transferring over the market replay files, the files are pasted at the exact same location on the other PC using the exact same file structure.

                    The My Documents-->NinjaTrader 6.5-->db-->data folder contains date folders that each contain recorded data for that particular day. Make sure there are no other files located in these folders.
                    JasonNinjaTrader Customer Service

                    Comment


                      #11
                      I eyeballed the charts and they looked the same... BUT I just found something very odd. I put in the code to print out the value of MFI(5)[0] and the current time. I then ran it, and opened up a chart at the same time. The strategy was run against RIMM using 100 tick so those are the values output, the chart was opened for rimm with 100 tick as well. Here is a snippet of values:

                      time: 5/26/2009 8:54:16 AM 52.135983824687
                      time: 5/26/2009 8:55:16 AM 31.9153989274463
                      time: 5/26/2009 8:56:20 AM 27.2765622324167
                      time: 5/26/2009 8:57:28 AM 15.1423569431598

                      Notice at 8:56 the value it says MFI(5)[0] is 27.27 but the chart i have below for 8:56 shows a value higher.. but hard to really tell, much easier to see on the very next bar 8:57. It shows value of 15 but the chart shows its clearly still above AT least the 20 line.

                      How is it possible that my chart shows one value for the indicator but the strategy at the same exact moment is seeing a VERY different value?


                      Comment


                        #12
                        frostengine,

                        In your indicator please ensure you have absolutely no CalculateOnBarClose line in the code.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          In the indicator itself which is MFI that comes with NinjaTrade the only calculateonclose line is this:

                          indicator.CalculateOnBarClose = CalculateOnBarClose;

                          In my actual strategy itself I have:
                          CalculateOnBarClose = true;

                          Comment


                            #14
                            Please remove the CalculateOnBarClose statement in your strategy as per the indicator.

                            Unfortunately strategies that call indicators need to ensure the indicator has no CalculateOnBarClose setting.
                            JasonNinjaTrader Customer Service

                            Comment


                              #15
                              If indicators can't have calculateonbar close then why does the system indicators such as MFI that comes with NinjaTrader have this setting? Also when you create a new indicator that is the default option. If this is a problem shoudn't that be changed?

                              I created a new indicator since I can not modify a system indicator. Copied everything over for it and removed that line. Did not make a difference the values it outputted was exactly the same.So, that is not the problem.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by JoMoon2024, Today, 06:56 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post JoMoon2024  
                              Started by Haiasi, 04-25-2024, 06:53 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post Massinisa  
                              Started by Creamers, Today, 05:32 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post Creamers  
                              Started by Segwin, 05-07-2018, 02:15 PM
                              12 responses
                              1,786 views
                              0 likes
                              Last Post Leafcutter  
                              Started by poplagelu, Today, 05:00 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post poplagelu  
                              Working...
                              X