Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect Opening Price

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

    #16
    I've attached a screenshot of FAS for today with the currentOHL indicator and it looks like 51.53 is the correct value I should be getting. not 51.49.

    51.53 is the price I get when opening up esignal directly.

    To re-iterate. When I have the strategy running at the open, currentOHL is returning a value that is not consistent with either this graph attached or opening esignal directly. If I stop the strategy after the open and then restart it, then it returns the correct value.

    Trying to figure out why when the strategy is running at the open do I get back an incorrect value.
    Attached Files

    Comment


      #17
      Could it be that the opening price is set after the fact?

      And that Ninja, as the strategy is running, takes the first tick - which may not be the official opening price? Upon a regeneration of the chart, then you get the (in the meantime available) official opening price set.

      Working with opneing and closing prices from tick streams is tricky. Given that you dont want the prices in the strategy (and already processed) to change, I could see this as the culprit. Not that I would have ANY idea how to fix that.

      Comment


        #18
        IZ_Trader, which session times are you using as you start your strategy? If your chart uses the default 24 hrs, but you set different ones for the strategy you would for sure have a different value returned by the CurrentDayOHL in the strategy.

        Comment


          #19
          it looks like the session times are consistent for both the strategy as well as the chart I set the session time to begin at 6:30AM and end at 1:00PM. This is PST.

          NetTecture, you make an interesting point as it feels like it is pulling a price from some random tick before or right after the open, as the opening price returned is typically a few cents away from the actual opening.

          I'm totally stumped here as to what is going on. The only thing I can think of is to start the strategy a few minute after the open, but that kind of puts a damper on the whole automated trading idea

          Don't know if any of this will help but here is my initialize() code

          protected override void Initialize()
          {
          CalculateOnBarClose = true;
          ExitOnClose =
          true;
          ExitOnCloseSeconds =
          60;
          TimeInForce = Cbi.TimeInForce.Day;
          TraceOrders =
          true;
          IncludeCommission =
          true;
          // If an open position already exists, subsequent EnterLong() calls are ignored.
          EntriesPerDirection = 1;
          EntryHandling = EntryHandling.AllEntries;
          Add(otherInstrument, PeriodType.Minute,
          1);
          }

          Comment


            #20
            Well, what IS your opening price?

            Do not forget that opening and selling price are sometimes determined by the exchange and not necessarily identical to the first tick data. At least on non-electonic exchanges.

            I know that Zen-Fire reports me the "official session open" when I connect.

            I am SERIOUSLY not sure whether electronic trading has a similar mechanism to report an official opening price. It would somehow make sense, though. The first ticks can be a little random.

            This is different during trading. It should not make a BIG different in most circumstances.

            Comment


              #21
              IZ_Trader, I'm outta ideas here unfortunately, which feed are you using? Have you asked them about the opening price reporting methods they employ? Maybe it helps to Add() a small tick chart to try 'grabbing' the open as early as possible...

              Comment


                #22
                I've tried using esginal and IB as data feed providers. I have seen similar issues with both providers so I assumed it was something I was doing wrong. Esignal should be a better data provider than IB as IB only provides at most 5 seconds bars. I have changed some code since i tried IB last time so I will try again tomorrow morning just to confirm. I have actually written an Exchange management system that can trade through IB directly and it gives me the correct opening prices on it's first bar, so that is why this really wreaks of a config or coding issue on my part.

                I'm not sure what you mean by Add() a small tick chart. Sorry for my ignorance, I'm still new to this, literally been using Ninja for only 3 weeks.

                By the way, thanks for your guys' help on this.

                Comment


                  #23
                  Multi-time frame strategy is what Bertrand is suggesting.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Ok, IB. You should contact them.I am not sure the opening is relevant with them. I mean, they provide snapshots - what if that is not the first tick?

                    Otherwise, maybe the first tick got cancelled? That would also explain discrepancies.

                    May I ask what instrument, what date (as example) and how many tick the difference was?

                    Comment


                      #25
                      IB should provide the correct opening. When I access the IB feed directly through my own EMS I get the correct opening price. It is only through Ninja that the data differs.

                      Date: 7/27/2009
                      Instrument: FAS
                      Real opening: 51.53 ( this is what I was expecting)
                      Reported opening: 51.49 ( this is what I am getting which looks incorrect)

                      Comment


                        #26
                        All I can say is for you to clear your database, reopen NT and try again. NT displays whatever is received from IB. You should also be checking your chart's session definitions.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #27
                          Will do, to be clear, the chart session times should not affect my strategy correct? That is, if I have my strategy session time set correctly, but my chart session time is set to the default, I should still get feed data for the time frame defined in my strategy, correct?
                          I need to ensure my chart session time frame is consistent with my strategy's so I am comparing apples to apples?

                          I read through this reference and saw something interesting


                          When reading through this it seems since I am using calculateOnBarClose = true; that this should not affect me but one line made me nervous. Maybe I should be using tick by tick?

                          "The point is if you have a multi-time frame strategy in real-time and it is processing tick by tick instead of on the close of each bar, understand that the OHLCV data you access in real-time is different than on historical data."

                          Comment


                            #28
                            The difference is in how the bars build up. You can see the figures for how the bars build depending on real-time or backtesting.

                            If you are running your strategy from a chart, it will take the chart's session as the strategy's session. This may be the easiest way to compare apples to apples.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #29
                              I took your advice and ran the strategy against the chart. I have attached two chart captures.

                              "FAS 8_4_2009 (1 Min)_1" is the chart when the strategy is started prior to the open of the day. (6:30am pst) Opening price is indicated as 62.12

                              "FAS 8_4_2009 (1 Min)_2" is the chart after the market has opened and I have right-clicked and choosen refresh historical data. Same chart would show up if I started the strategy after the open. It's opening price is indicated as 61.26 which is what I would expect as accurate. Every other candle looks the same. Does this shed any light on what may be going on?

                              Thanks
                              Attached Files

                              Comment


                                #30
                                Unfortunately that may just be the data IB is pushing through on the open. When you reload historical data it is not pulling real-time data any more, but rather from a historical feed which can be different.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by CarlTrading, Yesterday, 11:51 AM
                                0 responses
                                16 views
                                0 likes
                                Last Post CarlTrading  
                                Started by CarlTrading, Yesterday, 11:48 AM
                                0 responses
                                21 views
                                0 likes
                                Last Post CarlTrading  
                                Started by CaptainJack, 03-25-2026, 09:53 PM
                                0 responses
                                16 views
                                0 likes
                                Last Post CaptainJack  
                                Started by CaptainJack, 03-25-2026, 09:51 PM
                                0 responses
                                13 views
                                0 likes
                                Last Post CaptainJack  
                                Started by Mindset, 03-23-2026, 11:13 AM
                                0 responses
                                20 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Working...
                                X