Hi all, I am new to programming, but I am a part time day trader for a few years now. I am attempting to write an algorithm here as I learn Python elsewhere. I have this bit of code from a tutorial I reviewed:
def before_trading_start(context, data):
output = pipeline_output('pipeline_tutorial')
context.my_universe = output.sort('ma_ratio', ascending=False).iloc[:300]
update_universe(context.my_universe.index)
If I am not mistaken, this updates the universe of stocks pre-market, correct? How can you change it so it updates at different intraday intervals like, 5, 15, 30 minute or 1 hour? So if there was a moving average crossover intraday, the stock would be added to the universe and bought or sold.
I just wanted to challenge myself to write a day trading algo that trades off of exponential moving averages and volume (not necessarily for live trading) .
Any help is greatly appreciated.