BuyAtLimit fails when Low[bar] == buyLimit Price ?
Author: minourat
Creation Date: 7/31/2010 12:53 PM
profile picture

minourat

#1
I used the following workaround:

CODE:
Please log in to see this code.


I occasionally encounter this problem in actual trading.
Is the feature intended to simulate this reality?
profile picture

Eugene

#2
Is slippage enabled?
profile picture

dansmo

#3
This could be the same bug as I described here:
/Forum/Posts/Number-of-decimal-places-30405
profile picture

Eugene

#4
We have no ticket, so it's not a bug (at least officially).

If using Yahoo/Fidelity data (which is likely to be the case with the topic starter), there's no problem entering a limit order at the exact low (which is unrealistic anyway) if you disabled AtLimit order Slippage.

This double precision issue can happen with other data sources (like your BBLoader data) where the data has more digits than the tick (e.g. something like 10.46000004 instead of 10.46).
profile picture

dansmo

#5
There is a ticket: 19094.
profile picture

Eugene

#6
Sorry, my bad.
profile picture

minourat

#7
I did a little more testing on the data from Fidelity and found the following failed cases.
The slippage was disabled.

Limit buy at 72.10 failed with OHLC = 72.23 72.32 72.091 72.32
However, a limit buy at 72.10001 was executed. In this case the price bought at was 72.10.

Other failed cases were

Buy at 65.6 with OHLC = 65.85 65.85 65.59998 65.6
Buy at 74.20 with OHLC = 74.21.74.22 74.0109 74.03
profile picture

minourat

#8
Another case of failure:

Tried to buy IWO at 76.97
bar = 6474, Bars.Date[bar] = 5/4/2010 9:35:00 AM
OHLC = 76.97, 76.97, 76.21, 76.38

Does BuyAtLimit() fail if the limit price is considered to be outside the range of the current Bar?
profile picture

Cone

#9
It shouldn't be possible to to create a trade outside a bar's range (wouldn't everyone like to buy GOOG for 50 cents?), but a limit order should execute at the limit price or better. In the previous case, the 76.97 limit order should have executed at the opening price.

It also should have executed at the open if the limit price were at any price above 76.97 too. Note however, that Fidelity's back end will [unfortunately] require that Wealth-Lab limit order be at or below the last trade price, otherwise the order will error out. Generally, that's good for protecting you from a fat-fingered entry, but it definitely not something that's desirable if the market is moving quickly and you really wanted your limit order to execute "at market".

Nonetheless, we've got the bug entered, and it will be investigated and hopefully fixed in the December releaase.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).