Dear all,
First I would like to say that I enjoy quantopian very much. I think it is a fascinating idea and the implementation of the IDE and backtester is very well done!
I am new to algorithmic trading and I have some basic questions about pitfalls, in particular in the light of global variables.
I would like to design an algorithm that buys stocks, holds them for a given fixed time and then sells them. This means, a function will decide at the point the item is bought also the time it is sold.
I have attached a template which illustrates how I imagine this could be done, but I would be interested in possible better ways of doing this. In particular, I have to introduce a global variable which keeps track of all the stock that is in the portfolio with a date when to sell it.
Are there any concerns using global variables for such long running jobs? Is there a built in global variable that I should use instead? The goal is live trading - is there any pitfalls with this approach?
best regards
Wolfgang