The problem is as follow:
Position amount = 1,000
Stock Open Price = 10
Stock Close Price =20
When I use buyatclose, it indicates buying the stock at 20(which is right), but it buys 1000 shares(it uses the open price to calculate the position size), therefore given the wrong position size.
Any reason?
thx
Size:
Color:
I don't follow your logic given the quantities you provided (maybe you meant that the Position was 100 shares), but the basis price for AtOpen and AtClose orders is the previous day's closing price (not the open). This is discussed in the "100% of Equity Sizing" topic in the User Guide, and, there are programming solutions for controlling the basis price using an AtLimit order. Similar logic (albeit more complicated) could be used for AtClose orders too, if required.
Size:
Color: