Intraday strategy with reference to daily Moving Average
-
It is very common to reference the 200-days moving average during trade,
I am trying to implement an intraday strategy, which will taking account the 200-days moving average.However, I can't figure out how to load 200-days bar while I loaded 1-min data into backtrader
Also, I just wonder how can we start live trade in day-by-day manner, that the strategy can reference 200-days MA immediately in the start of trade?
Any ideas ? so much thanks.
-
You have to add 2 (or more depending on your use case) data feeds
- Intraday
- Daily
And run a moving average on the daily one which is the 2nd data feed in the array
self.datas
. See: Docs - Data Feeds - Multiple TimeFrames@sobeasy said in Intraday strategy with reference to daily Moving Average:
Also, I just wonder how can we start live trade in day-by-day manner, that the strategy can reference 200-days MA immediately in the start of trade?
Your daily data feed has to simply feature enough data before the live feed to be able to provide a
200-period
moving average. -
@backtrader thanks for the prompt reply!
I will work on it later.