Why BuyAtLimit does not always buy at Open?
Author: Bloo
Creation Date: 4/3/2018 11:52 PM
profile picture

Bloo

#1
Hello,
I am new to WL but have some experience with development.

So far I have written some code to connect to my local db and pull a list of symbols along with predetermined entry dates. I noticed that the numbers looked funny and upon closer examination, I noticed that BuyAtLimit would not buy. Using daily bars, I used the following code in an attempt to buy at the Open of the following day (bar):

CODE:
Please log in to see this code.


And yet, sometimes it would return null. I have been pulling my hair out and then when I added a penny to the purchase price, it worked as expected:


CODE:
Please log in to see this code.


After adding the "+ .01" to the limit price, the order was not null and transacted as it should. I could not for the life of me figure out why it would behave this way. Either I am missing something, or this is a bug. I have only been playing around with WL for a few weeks and am so far pleased with the progress I have been making in learning this software, but I must understand the nature of this behavior, as I feel I am missing something.

Thanks in advance
profile picture

Eugene

#2
Welcome to the forum Ted.

What you experience is due to the tick adjustment of stop/limit orders which is active by default. To find out more about this behavior and how to turn it off (and when not), check out the Wealth-Lab User Guide:

Preferences > Backtest Settings > Price rounding for orders > Turn off limit/stop order rounding entirely

P.S. Please avoid judgmental topic titles like "Possible Bug with AtLimit Orders". Let technicians decide. Instead, sum up what happens in a short sentence in the spirit of "A wise man's question contains half the answer". For example, like it sounds now after renaming: "Why BuyAtLimit does not always buy at Open?" Thanks in advance.
profile picture

Bloo

#3
Thanks for your quick and helpful response. I will avoid using titles such as those you described in the future.
profile picture

Eugene

#4
Glad to help you.
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).