I have programming experience with Pascal but none with Python. I have a simple strategy that I'm hoping somebody will be able to help me code:
1. For a simple basket of stocks (AAPL, HD, WMT, PM, UL) I would like to order a certain target percentage of each stock ( 50% AAPL, 25% HD, 13% WMT, 7% PM, and 5% UL) when the SPY is trading above the 100 day MA AND when the 50 day MA > the 100 day MA.
1.Once the SPY trades below the 100 day MA AND the 100 day MA > the 50 day MA, I'd like to adjust my portfolio to (5% AAPL, 7% HD, 13% WMT, 25% PM, and 50% UL).
3.When neither of those two conditions are met, I'd like to keep my portfolio as is.
Can anybody help me put this logic to code?