fastquant icon indicating copy to clipboard operation
fastquant copied to clipboard

[FEATURE] Support Average True Range (ATR) from Backtrader

Open sgoley opened this issue 4 years ago • 1 comments

Backtrader has an implemented indicator for the Average True Range: https://www.backtrader.com/docu/indautoref/#averagetruerange

I'd like that indicator to be accessible within fastquant for either solo or multi-strategy backtests.

I could be wrong but it looks as simple to me as adding a mapping to the indicator in the backtrader library here: https://github.com/enzoampil/fastquant/blob/master/python/fastquant/indicators/backtrader_indicators.py

However, to then make it available to the backtest function mapping, a new strategy would have to be created here? https://github.com/enzoampil/fastquant/tree/master/python/fastquant/strategies

Thanks.

sgoley avatar Oct 24 '20 17:10 sgoley

@sgoley Hi Scott, you are exactly correct. You can easily utiliize ATR from backtrader by adding a new strategy in the strategies module and adding it to the backtest function mapping :smile:

Can you let me know the specific use case you have for ATR? If it's to use it as basis for stop losses, we might want to integrate it directly to the BaseStrategy, since this is likely useful as a feature to any trading strategy.

Also, if any of this isn't very clear, I'm happy to answer any questions and give concrete assistance :smile:

enzoampil avatar Oct 25 '20 05:10 enzoampil