-
I test a simple strategy, like if self.data.Close[-1] > self.data.Close[-2]:
self.buy()
if self.data.Close[-1] < self.data.Close[-2]:
self.sell() however, when bt.plot(), Trades(1) showed. What's happening? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Buy and sell methods, by default, make orders for size equivalent to full free equity (available cash + margin), which fluctuates in time depending on the underlying OHLC values. You might want to consider passing explicit buy/sell Alternatively, you should be able to control the explicit closing of trades with |
Beta Was this translation helpful? Give feedback.
-
@kernc hello bro!, is the size parameter given in USD terms? I mean, when I see the _trades results I see "-883" (for example). Is that number the size in USD (the quantity of USD I use to open the trade)? |
Beta Was this translation helpful? Give feedback.
Buy and sell methods, by default, make orders for size equivalent to full free equity (available cash + margin), which fluctuates in time depending on the underlying OHLC values.
You might want to consider passing explicit buy/sell
size=
parameter.Alternatively, you should be able to control the explicit closing of trades with
trade.close()
orposition.close()
.