Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SubscribeMarketData does not work properly

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

    SubscribeMarketData does not work properly

    I am making use of SubscribeMarketData to request data from IB. This is necessary in FX trading because my signal are generated using TS which uses GAIN FX data. My trades go to IB. I was trying to plot side by side the two bids and asks to get an idea how far they are.
    The following code below is what I use

    Code:
     
    Once (RealTIme) Begin
        Condition1 = NtSetUp(Server, 36973); 
     Condition1 = NtConnected(0);
     hasData = SubscribeMarketData(GetSymbolName);
    End;
        bidValue = 0.0;
     askValue = 0.0;
     
     If NtConnected(0) Then Begin 
          bidValue = NTMarketData(1);
        askValue = NTMarketData(2);
     End Else Begin
           Condition1 = NtSetUp(SERVER, 36973); 
           hasData = SubscribeMarketData(GetSymbolName);
     End;
    Some of the charts plot the data correctly some do not. They ones that do eventually stop plotting and just maintain a straight line with the last price returned (I guess). Attache is a picture of this. As you can see from the code above I set the bidValue and askValue variables to 0. In this case the plot should show a horizontal line at 0. WHat is shows is a horizontal line at some value for the underlying symbol. This mean NTMarketData returned something and I am connected. I am definetely connected to NT and IB because trades are being fired and filled.

    The NTMarketData is just a function wrapper for:
    NTMarketData = MarketData(GetSymbolName, PriceType);

    I changed the code once to request data (that is call SubscribeMarketData) every time before reading the data. This worked fine for a while but eventually I notice the CPU running at 100% and NT GUI Hanging. It appears that it could not handle that amount of requests.

    I believe that at some point NT stops pulling the data from IB and it just returns the last value. This is very important for FX trading.


    Moscu.
    Attached Files

    #2
    When you say some plot and some do not, can you be more specific?

    - Some instruments plot and some do not?
    RayNinjaTrader Customer Service

    Comment


      #3
      Here are the images

      Attached are an image of one chart working (USDCHF) and another one not (EURJPY). The red/blue line is the bid/ask from IB thru NT. The yellow/cyan is the bid/ask from TS. I only have 3 charts open at the moment.

      Moscu
      Attached Files

      Comment


        #4
        Now the working chart stop working

        Here is an attachment of the USDCHF which I previously posted as working. It just stop returning the bid/ask and it is flat. IB connection is up and IB window is showing bids and asks.

        Moscu
        Attached Files

        Comment


          #5
          What NT version are you running? Please check via Help > About.
          RayNinjaTrader Customer Service

          Comment


            #6
            I am using Version 6.5.1000.5

            Comment


              #7
              There were some changes made to the ATI since that version, this may or may not have impact. To rule this out, could you please update to our most recent version, 6.5.1000.7 available on our website. Thanks.
              RayNinjaTrader Customer Service

              Comment


                #8
                No Luck with 6.5.1000.7 either

                I install the release 6.5.1000.7 and I run the charts again. I am still seen the same problem. Look at the attached AUDJPY pics. One from TS shows that the ask/bid started plotting right and then it stopped. I plotted a chart with NINJA and it shows the same wrong value as in the previous one, the pic is named AUDJPY-TS.JPG.
                Attached Files

                Comment


                  #9
                  Originally posted by moscu View Post
                  I install the release 6.5.1000.7 and I run the charts again. I am still seen the same problem. Look at the attached AUDJPY pics. One from TS shows that the ask/bid started plotting right and then it stopped. I plotted a chart with NINJA and it shows the same wrong value as in the previous one, the pic is named AUDJPY-TS.JPG.

                  Moscu,

                  Thank you for the participation on our forum, can you please post your TradeStation code so we can run comparisons over here and reproduce this issue?

                  Thanks in advance!
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    I just email you the EL code.


                    Moscu

                    Comment


                      #11
                      Hi moscu,

                      Thanks for mailing the code.

                      We will try to reproduce this behavior and let you know.

                      Have a great day!


                      Originally posted by moscu View Post
                      I just email you the EL code.


                      Moscu
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Hi moscu,

                        Thanks for your patience, I tried reproducing it, but so far it works fine over here.

                        1. Did you get any TS errors, reported to the Event Log?

                        2. Did you run your studies on Update Every Tick?

                        Thanks and great weekend!
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          You need multiple charts

                          Did you try having multiple charts with multiple Symbols.

                          I have 20 workspaces each with 2 charts. The charts are 25/35 tick per bar. I use the following currencies AUD, CAD, CHF, EUR, GBP, USD, JPY, NZD.

                          If you load the study in each of the charts it should happen.


                          Moscu

                          Comment


                            #14
                            Hi mosco,

                            Thanks for your reply, I tried reproducing it with 2 pairs.

                            I will try it with the pairs you listed below and see if the issue shows up.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Bertrand:

                              I have also notice this happening when IB data service is disconnected. IB data it is disconnected couple times per day specially after 5:00 PM East. So there might be two cases where this happens. The problem here could be that NT fails to request the data again. Probably a flag needs to be reset when this happens. If you see my conde when TS disconnects from NT It automatically connects again. So the problem must be in NT requesting data from IB again.

                              Moscu

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by BarzTrading, Today, 07:25 AM
                              2 responses
                              14 views
                              1 like
                              Last Post BarzTrading  
                              Started by devatechnologies, 04-14-2024, 02:58 PM
                              3 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by tkaboris, Today, 08:01 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post tkaboris  
                              Started by EB Worx, 04-04-2023, 02:34 AM
                              7 responses
                              162 views
                              0 likes
                              Last Post VFI26
                              by VFI26
                               
                              Started by Mizzouman1, Today, 07:35 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Working...
                              X