I am trying to achieve the following functionality using QuickFIX for FIX 4.2

  1. Send a couple of orders and make sure they’re filled.
  2. Then disconnect.
  3. Change the incoming (from Broker) sequence number to a lower number. Example if it is 300 i now change it to 260.
  4. Log back in.
  5. My Application should detect the sequence number from Broker, as lower than what is expected and my side should automatically send a type 2 (resend request) message to Broker.
  6. Broker will gap fill/send missing data.

At the moment when i attempt the step 3 (i.e change to sequence number from broker to a lower value) and then attempt to login, my applications logs out immediately with the error message the MsgSeqNum is lower than what is expected.

I am familiar with the ResetSequenceNumFlag, ResetOnLogon, ResetOnLogout flags but they don't seem to be the right choice for the above procedure.

  • $\begingroup$ You're supposed to reset your sequence number, not the exchange's. If the counter-party sequence number is wrong, then you will definitely get an error. $\endgroup$ Apr 30, 2012 at 12:44
  • $\begingroup$ Sounds like this is really a question about QuickFix, and not FIX in general. Can you show us the error message? $\endgroup$
    – windfinder
    May 2, 2012 at 18:39
  • $\begingroup$ Below is the error message i get while QuickFix logs out my application: 20120503-07:19:08.551 : ^8=FIX.4.2^9=115^35=5^34=11^49=***^50=******^52=20120503-07:19:08.550^56=*********^58=MsgSeqNum too low, expecting 9 but received 1^10=211 $\endgroup$ May 3, 2012 at 7:21
  • $\begingroup$ Are you using QuickFix/j? $\endgroup$ Oct 24, 2012 at 10:06

2 Answers 2


Are you sure there is a practical use case behind this (especially step #3). Brokers don't switch sequence number back in the middle of the session. If you absolutely need to support this use Sesssion.setNextTargetMsgSeqNum() API

  • $\begingroup$ Yes you are right about Brokers switching the sequence number back. But the above steps are required by the Broker to complete there certification. $\endgroup$ May 4, 2012 at 7:36
  • $\begingroup$ Also i tried Sesssion.setNextTargetMsgSeqNum() but "setNextTargetMsgSeqNum()" or anything similar to it is not available. I am using QuickFIX/n $\endgroup$ May 4, 2012 at 16:32

I am using QuickFIX/n, initially there were no methods to change the sequence number but we requested the QuickFIX/n developer community for adding methods to change the sequence numbers and in the later builds Session.NextTargetMsgSeqNum and Session.NextSenderMsgSeqNum were added to change the sequence number.

And i was able to easily change the sequence numbers according to my requirements using the methods Session.NextTargetMsgSeqNum and Session.NextSenderMsgSeqNum.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.