Thanks a lot!
Best posts made by bowguo
Latest posts made by bowguo
Why the executed price of a market-type order is the open price of next period instead of the close price of current period?
Why the executed price of a market-type order is the open price of next period? To me it makes more sense if the executed price is the close price of current period.
When placing a market-type order, the market has not closed yet, so why not executed with the close price of current period?
What is an order's executed psize and pprice?
order.executed.pprice? According the doc, psize is the current open position size and pprice is the current open position price.
Still, the meaning is not clear to me. Could someone please explain in more details?
Sell a specific completed buy order
Let's say I first place a buy order. After this order is completed, I now hold a long position.
Then I place a sell order with the same size, and after the sell order is completed, will I hold both a long and a short positions, or my position is zero because the previous long position is now sold?
If the sell order sells the previous long position, then I have a question. If I have two completed buy orders with different executed prices, now I place a sell order, which buy position will be sold exactly? How can I sell a specific buy order?
RE: How to change the size and take-profit of a bracket of orders
I use the following code to create a bracket of orders:
main_order, stop_order, limit_order = self.buy_bracket( size=size, price=target_price, limitprice=limit_price, )
After the main order is completed, I want to change the limit order's limit price, my current implementation is
limit_order.price = new_limit_price
Will this work?
How to mimic forex spread in backtest?
I am using backtrader to backtest my strategy for forex trading. In live trading there is spread (difference) between the buy and sell price of a currency. For example, the price of euro/usd is 1.1850/1.1857, meaning when I buy one euro, I need to pay $1.1857; yet when I sell one euro, I can only get $1.1850. This spread can really make a difference to the profit of my strategy.
How can take the spread into consideration when doing backtest?
Does the current close data already happen when invoking next method in backtest?
Hi, I am new to backtrader. When doing backtest, does the current close data
self.data.closealready happen when invoking
nextmethod of strategy? If it has not happened yet, then it will be illogic to use current close price in
How to change the size and take-profit of a bracket of orders
I have placed a bracket of orders such as
self.buy_bracket( size=size, price=target_price, limitprice=target_price + take_profit )
Now after the buy order has completed, I want to change the size and take profit of this order. How can I do that?