enzoampil / fastquant

fastquant — Backtest and optimize your ML trading strategies with only 3 lines of code!
MIT License
1.48k stars 236 forks source link

How to get previous and current row while implementing the strategy #408

Closed YASHGUPTA2611 closed 2 years ago

YASHGUPTA2611 commented 2 years ago

Capture Whats the difference if we put self.upperband[0], self.upperband[-1], self.upperband[1]?

I want to consider my upperband values a previous row and the closing price as current for the besting of my strategy.

mikeejazmines commented 2 years ago

For simple crossovers, i suggest using the crossover function https://www.backtrader.com/home/helloalgotrading/

it would be a much simpler implementation. also backtrader follows regular indexing in a timeseries, so 0, -1, 1 does the same as a regular timeseries

YASHGUPTA2611 commented 2 years ago

ok understood, Thanks