if we use this, we solve the data sync problem and we don't have data duplication.
if self.datas.datetime == self.datas.datetime
hmm - I'm not sure. For backtest scenario it may depend on exact timestamps used by each data feed. In case they are different or offset (even slightly) - the above statement may always be false. For live trading scenario this may be even more emphasized.
IMHO the solution provided in the referenced post (above) seems pretty solid. If the length of each data is tracked inside the strategy - one may definitely state which data was updated in each next call.
@run-out Hey thanks for this. I tried ab_traders answer but it didn't seem to work for some reason.
I sorted my list of data frames on the basis of their lengths which would mean the newest data frame would be the last in the list and the oldest data frame with earliest index will be the first. But I got the same result as before.
I went through your answer then and that worked for me. I reindexed all data frames to start from the earliest index.
@the-world Yes, it uses C# but it's a completely different system than BT so you can't compare the two simply on implementation language. It may have something to do with how they process historical data? (I'm guessing here). I'd have to try writing two identical algorithms in each to really understand how they compare and it's not something I've tried or plan to do.
@tony-shacklock Hi , Thank you.
Now it works fine. But I thought when it runs blank it suggests some problems with the condition of buy or sell or in position, but those were right . I fell like sometimes backtrader don' t want to work proprely ahah maybe is jupyter notebook.
Anyway now I will do optimazation for this 4 parameters , I' ll let you know results.