@sadegh said in Profit:
How can I Take the Profit Of A trade in backtrader
Trade information is returned in notify_trade() method.
Some time ago I wrote trades analyser. You can use it as example of trade price processing.
@vladisld said in Interactive backtrading:
The closest topic I remember seeing on this forum was a discussion about live chart support .
Probably you may find some useful ideas there.
Great, thanks. :) Charts with live data can be a next step.
I ended up using a version of @run-out 's suggestion without the datetimerange, using two custom trade hour params with corresponding params in my strategy
cth_start = datetime.datetime.strptime(args.cth_start, '%H:%M:%S').time()
cth_end = datetime.datetime.strptime(args.cth_end, '%H:%M:%S').time()
and then within my strategy simply:
if (self.data.datetime.time() < self.p.cth_start) or (self.data.datetime.time() > self.p.cth_end):
@leecallen most of this info is commented in the source code of the data feed. you would also need to read some of the source code: https://github.com/ftomassetti/backtrader-oandav20/blob/master/btoandav20/feeds/oandav20feed.py
@Onder-Oz said in How to do intraday trading in backtrader ?:
does backtrader have access to preMarket data too in smaller timeframes
Backtrader accepts any data, pre/post market included. Just be sure your data provider supplies such data.
It looks like there are several open bugs in the code since some time which I guess won't be fixed anymore. So when you plan to get into BT then be ready to work with the code to be able to cope with bugs/problems. It surely is worth it though. You can find some fixes/improvements in other people's BT forks.
@Mislav-Šagovac said in How to use pandas series with time index as in backtrader?:
But again I have ti construct indicator using bt.Indicator.
If you already have them in that external function, than you don't need to do it.
I copied and tried optunity's 'grid search' option. What I found is that the searching term between parameter values are decided by num_evals. (High num_evals => 1..2..3..n/ Low num_evals => 1..5..10..n) That's why grid search is faster than the theory.
It seems to me that all backtesting framework I tried don't have some easy way to include ML models inside them. It's not rare that we need hundreds of variables in ML, based on OHLC data. I don't understand how to construct this data inside backtrader. I know I can write function for generating every indicator by hand, but that's probably the last option. I have function that generate fatures on padans df using talib package and some my own calculations. Nut I cant just call this function in backtrader.