Backtrader Issues & What's wrong with these tactics?
-
Backtrader Question
How to model "real" trading environment?
-
For forex using Oanda as broker.. How do I realistically model slippage? Is there a best practice or "known" slippage parameters that I should be using?
-
Completely noob question - For forex using Oanda as broker.. How do I realistically model commission on Cerebro? (I know the spread is built-in, which I get through the feed)
-
Is there a way to tell (in next() or another predefined method) if the end of the data feed has been reached?
-
Suppose i have a datafeed that I use pandas to resample in 1 minute time frame. And because of volume issues, instead of using cerebro.resampledata(), i want to use pandas to resample to 3 minute time frame. Do I need to pass this pandas resampled data by calling cerebro.resampledata() or cerebro.adddata()? And what timeframe/compression timeframe parameter do I need to add (since it's already resampled in pandas)? Is it bt.TimeFrame.Minutes / 3?
General trading question
- Is "averaging" ask/bid data to tweak algo problematic?
Currently, im taking the average (ask + bid / 2) to calculate OHLC for both price and via pandas. What is the fundamental problem with using the average to write your algo? I would think that it might be smarter to calculate long entry position based on ask price & volume... and short position on bid price / volume, but this would mean keeping "two" copies of data stream
- What are known problems using stop limit orders to minimize slippage, other than missing out on potential orders in markets with low volume and fast moving markets? THe only thing I would guess is that creating the stop limit order "gives" hints to the broker... who might be using it against you if their not None-Dealing-Desk broker.
-
-
@Taewoo-Kim said in Backtrader Issues & What's wrong with these tactics?:
- Completely noob question - For forex using Oanda as broker.. How do I realistically model commission on Cerebro? (I know the spread is built-in, which I get through the feed)
You cannot. As you point out: it is built in the spread. There is no way to separate it in real life and there cannot therefore be a way to simulate that.
- Is there a way to tell (in next() or another predefined method) if the end of the data feed has been reached?
Your strategy will stop calling
next
and will callstop
- Suppose i have a datafeed that I use pandas to resample in 1 minute time frame. And because of volume issues, instead of using cerebro.resampledata(), i want to use pandas to resample to 3 minute time frame. Do I need to pass this pandas resampled data by calling cerebro.resampledata() or cerebro.adddata()? And what timeframe/compression timeframe parameter do I need to add (since it's already resampled in pandas)? Is it bt.TimeFrame.Minutes / 3?
If you don't want to resample in backtrader, don't use
resampledata
, which means you useadddata
. You should tell the platform that your data has a combination ofMinutes
and3
Currently, im taking the average (ask + bid / 2) to calculate OHLC for both price and via pandas. What is the fundamental problem with using the average to write your algo? I would think that it might be smarter to calculate long entry position based on ask price & volume... and short position on bid price / volume, but this would mean keeping "two" copies of data stream
If your assumption about the slippage isn't that bad, using the
MIDPOINT
should be fine. Slippage will get you below/above theBID
/ASK
prices and therefore give you a good approximation.The only thing I would guess is that creating the stop limit order "gives" hints to the broker... who might be using it against you if their not None-Dealing-Desk broker.
If you are worried about that, you should be operating with a different broker and probably a different market altogether.