Hello,
I recently joined quantopian. I have very basic Python knowledge. I am having trouble coding a very simple strategy and would like if someone could code this strategy so I can see how everything is coded. For this strategy simply backtest it on AAPL. This strategy is as follows:
Uses Daily Data
Long Only Strategy
Allocates 5% of account to buying shares of AAPL
when AAPL closes above its 200 day SMA and the previous days close was below the 200 day SMA from the previous day , go long.
set an end of day stop loss at 3 ATR below the entry price (if AAPL closes 3 ATR below the entry point then exit the current position)
Use the 200 SMA as a trailing stop. if AAPL closes below its 200 day SMA then exit current postions.
Your help is greatly appreciated. Thank you!