Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unlogical RT trading behaviour with IB

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

    Unlogical RT trading behaviour with IB

    Hi,

    With today's start of the US energy trading session (15:00 Vienna time) I made 4 new orders through my IB simulation account, each with a StopLossLimit. The trades were issued for the following 4 instruments:

    - CL 3-11 (Crude March 2011 Future)
    - QM 3-11 (e-mini Crude March 2011 Future)
    - NG 2-11 (Natural Gas 2011 Future)
    - QG 2-11 (e-mini Natural Gas 2011 Future)

    What happened is the following: The orders were forwarded to IB and filled. However a stop loss order was only produced for CL 3-11, although it should have been produced for all 3 other contracts as well. Within NT I only see the position for CL 3-11, although I do have positions for the other 3 contracts on IB as well (just without stops). I am confused....

    Thx, Peter

    #2
    Hello,

    Are you runnng the same strategy on each instrument or is this a multi series instrument?

    Also, Are the strategy positions all open? Indicating that the strategy has a current open poisition. Or just the account has a position? The strategy position is shown on the strategies tab.

    I look forward to assisting you further.

    Comment


      #3
      I am running the same strategy on each instrument. On the strategies tab only CL 3-11 does have a current open position, whereas on the account positions have been opened for the other instruments as well....

      Comment


        #4
        Hello,

        In this case the other instruments where not submitted trades to from the active strategies. However are most likely trades left over in the account?

        As the strategy position is flat on these other strategies. This would be the reason their is no stop loss and profit target since the strategy did not actually submit any orders.

        Comment


          #5
          Hello,

          So. what you say is that the other instruments where not submitted trades to from the active strategies. But why does IB then hold positions for that instruments (even if without stops, no profit targets were issued)?

          By looking at the NT executions tab it seems as if all 4 positions have been executed, right? However by looking at the Positions tab there is no position for NG (which is confirmed by IB). And finally the strategy tab only shows a position for CL. So, where does this mismatch come from, it was always the same strategy applied=

          Seems like communication with IB API worked up to a certain point and then stopped, but that's just a rough guess....

          I attach screenshots of NT and IB to confirn, what I say.

          Peter
          Attached Files

          Comment


            #6
            Hello,

            You have a few issues here.

            QM For example.

            Your QM Strategy is flat and enabled on the QM 03-11 contract. The position reported in IB is the QM 02-11. This This position is not from this strategy. Thats one.

            The NG Strategy is running on 02-11 wheras the execution was for the 01-11.

            Same with QG.

            Most likely you had these strategies enabled on the older contracts at some point in time.

            Comment


              #7
              No, I cannot agree on that:

              If you look once again at IB and take the time you can see that the positions there are for the exactly same instrument like in NT (don't get confused with the 2 HO positions, which are flat):

              QM: March 11
              QG & NG: both Februar 11

              Sorry, but that is no explanation for this strange behaviour of NT.......Any other explanations?

              Comment


                #8
                Hello,

                The proof for my explination is in your screenshots. I cannot be anymore clear. If you need me to further explain over the phone please send your phone number to support at ninjatrader dot com and reference this forum post. Put ATTN: Brett in the subject line.

                Comment


                  #9
                  Hello,

                  Again I have to come back, this time with a completely different issue, but again the real-time trading behaviour is completely different from simulation and it's WRONG!!!

                  I had now the first test case where I flipped in 3 futures contracts (all US equity index futures) in real-time the direction. I switched from a LONG position with today MOO into an SHORT position. In simulation this worked perfectly and in real-time trading (through IB) I had the following issue, explained for the e-mini S&P500:
                  - was 7 contracts LONG the ES
                  - got sell signal and should have gone 4 contracts SHORT the ES

                  What really happened on IB TWS was the following:
                  1.) 7 contracts were sold (this is correct = Sell to cover)
                  2.) 7 contracts were sold a second time (??????)
                  3.) 4 contracts were sold (this is correct = new position)
                  --> in total I have now a SHORT position of 11 contracts instead of 4 contract

                  Don't ask me, where this second 7 contract SHORT order does come from, but it happens on all 3 us equity index futures in the same way: ES, NQ and YM. I am selling two times.

                  Hopefully this can be solved fast, get's pretty frustrating the real-time testing of Ninja.

                  Peter

                  Comment


                    #10
                    Hello,

                    NinjaTrader will never submit orders unless you tell it to, it is simply doing what the automated strategy is telling it do to.

                    You would need to look into your exit/entry code as you have an issue here.

                    What NinjaScript method are you using for the exit? What methods are you using for entry?

                    Heres what I see as a strong posibility on whats occuring.

                    You use EnterShort() or EnterShortLimit(). Which if you are in a long position will flip you correct position into a short position with the same QTY size. This sounds like what occured here.

                    Then once this occured you had another call to EnterShort with a different QTY size which then also got executed at the same time.

                    However we would just need to look into the log files of what occured and look into the strategy as we have had to do in the past anytime you run into a strategy logic issue.

                    Comment


                      #11
                      Sounds reasonable, what you say, but why did that never happen in my simulation test and I did make a lot of them. I just checked my historical trades, where I flipped the position and it NEVER happens there. That's what I do not understand...

                      How should we proceed?
                      Last edited by unter821; 02-02-2011, 10:20 AM.

                      Comment


                        #12
                        Hello,

                        Limit and stops order can behiave differently in live vs Simulation. Simulation you always get a fill in a resonable ammount of time. When running live that may be delayed, or a delay live may cause an issue with strategy logic. Just grasping for straws here as without know that strategy code I'm just guessing here.

                        I have debugged your code now I think now 3 times you have sent it in for me to look into. Same as before. send it into support at ninjatrader dot com reference this forum post and I will take a quick look.

                        Also, please send the log files with the time that this occured.

                        My Documents->NinjaTrader 7->logs->log.TheDateThisOccured.txt

                        I look forward to assisting you further.

                        Comment


                          #13
                          I have attached the log file for today and rechecked my logic. Happened at 15:30 my time.

                          I am using ExitLong()to close the LONG Position and afterwards I am using
                          EnterShort(positionSize, "SHORT Entry") to get into the new SHORT position. That's what I do...
                          Attached Files

                          Comment


                            #14
                            So if I understand you correct: When I call EnterShort(positionSize, "SHORT Entry") into a working LONG position it does two things: Close the LONG position and OPEN the new SHORT position. So basically it does the complete flip?

                            Well, then the ExitLong() statement is not necessary, correct?

                            Comment


                              #15
                              Hello,

                              This is correct.

                              Please try this to see if this resolves your issue. First and we will go from there.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Barry Milan, Today, 10:35 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by WeyldFalcon, 12-10-2020, 06:48 PM
                              14 responses
                              1,427 views
                              0 likes
                              Last Post Handclap0241  
                              Started by DJ888, Yesterday, 06:09 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              40 views
                              0 likes
                              Last Post jeronymite  
                              Started by bill2023, Today, 08:51 AM
                              2 responses
                              16 views
                              0 likes
                              Last Post bill2023  
                              Working...
                              X