I am sorry this is turning to be a difficult to answer, it must be very complex process to add a
line to an
indicator in Backtrader. I am passing many
lines into my strategy at present and do not need help with extending data feeds, this process works just fine thank you.
Apologies if you think I am twisting things, I just didn't want to copy my over 2000 lines of code as I think it is distracting from the question at hand. I don't think it is a good use of your or my time to turn this into a full code review. I can assure you I am passing over 20 lines via pandas dataframes with ~30columns into the custom data loader with no issues, using my
analysiscols to specify the list of column names to pass as
lines. These lines are used by my Backtrader strategy in many places.
Given it appears to not be a straightforward process to pass a line to an indicator, and I am not aware of any documentation on how to specify a line for use in an indicator, I will just calculate the SMA outside of BT (in pandas) and pass it into backtrader as another line.
I am a big fan of backtrader software and use it daily, so this workaround will do just fine.