I have written an algorithmic trading program which relies heavily on low spreads in the 0.1-0.3 PIP region. I was now wondering if it would be a good idea to place bid/ask offers instead of limit orders to guarantee a low enough spread.

The problem I see with that is that of course I can't be sure that the trade goes trough. This is also really hard to simulate in backtesting.

So my questions are: 1. How likely is it that my trade remains in the market without anyone "buying" it? (Say my offer will be put exactly between the bid/ask prices) 2. How can I simulate that?

  • $\begingroup$ can you pls check your spelling at the very least, this is 2012, most every browser has a spell check function. Furthermore I vote to have this question closed. What do you want to know? Simulating a limit order book is one of the hardest things to do. I am not sure you wanna go down that route at your "current stage". And as Louis correctly pointed out each fx execution venue will impact the limit order book differently. Its simply impossible to simulate unless you pick a specific one and have specific observations you can build into your fill simulator. $\endgroup$
    – Matt Wolf
    Commented Nov 25, 2012 at 16:39
  • $\begingroup$ No it is not really impossible, from a historic order book, which I will analyze, I can calculate the probability to have a matching order within an acceptable time. $\endgroup$
    – Ralf
    Commented Nov 25, 2012 at 20:18
  • 3
    $\begingroup$ @Ralf You can't just calculate the probability of a fill just by looking at the historic order book. This question gets asked a lot [ 1, 2 ]. It is extremely difficult to also build the software to even handle an order book [ 3, 4, 5, 6, 7 ]. $\endgroup$ Commented Nov 26, 2012 at 0:33
  • $\begingroup$ Nice job on the links! $\endgroup$
    – Matt Wolf
    Commented Nov 26, 2012 at 1:23

1 Answer 1


First, I assume that when you say:

And I was no wondering if it would be a good idea to place bid/ask offers instead of limit orders...

You mean that you are going to be placing non-marketable limit orders inside the posted bid/ask spread; whereas before you were sending marketable limit orders that crossed the spread.

You didn't mention the type of market data your counter party is giving you, but I'll assume you have some view of a limit order book.

To your first question, the length of time your bid/offer rests in the spot FX market is going to be fairly impossible to estimate. Order flow and matching rules are fragmented and inconsistent and may also be exclusitory (meaning, trader A does not wish to match with trader B, even if possible given the LOB). You might attempt to estimate trade frequency and extrapolate that to the amount of time you can expect to rest assuming an optimistic matching algorithm with your broker/ECN. You might also try to condition your estimate with spread, trying to construct some conditional probabilities based on observed spread. Presumably, as you narrow the spread someone will be more likely to trade with you.

As for simulation, you're going to end up with a very optimisitic estimate. But, simplisticly, consider your order matched if observed trade price is worse than your posted price. If you have access to the LOB you should attempt to estimate your position in the book. Doing so will allow you to tighten up your assumed match critera to be any time an order below your estimated position in the book is executed. Of course, your estimate of position is going to be highly dependent on several assumptions, most notably latency to your counter party.

Once you go from taking liquidity to posting it, the cost of simulation in terms of time and complexity increases. Further, the more accurate you want those simulations to be will further drive the cost up.

  • $\begingroup$ Yes, that was precisely what I ment! Your idea with looking at a matched order at a worse prise is good. That was what i was looking for, thanks! $\endgroup$
    – Ralf
    Commented Nov 25, 2012 at 20:10
  • 1
    $\begingroup$ Upvoting meaningful answers to you encourages others to help next time...just saying... $\endgroup$
    – Matt Wolf
    Commented Nov 26, 2012 at 1:24
  • 1
    $\begingroup$ @Ralf, by the way simply looking at trades relative to your limit order gets you nowhere, you do not even need a LOB for that. As Lois pointed out you need to at the very least estimate your position in the queue if you want to do a half decent job. Your assumptions are way too simplistic and will result in unrealistic back tests. $\endgroup$
    – Matt Wolf
    Commented Nov 26, 2012 at 1:27
  • 2
    $\begingroup$ @Freddy: "Vote Up requires 15 reputation" Unfortunately I don't have 15 reputation. (On the rest I will comment once I've studied chris's links) $\endgroup$
    – Ralf
    Commented Nov 26, 2012 at 18:41
  • $\begingroup$ @Ralf, ok fair point re upvote, my apologies. $\endgroup$
    – Matt Wolf
    Commented Nov 27, 2012 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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