Hi,
I am new to Quantopian. I tried to clone a simple strategy and modified details myself. However it seem the strategy is NOT doing what I am asking it to do. Could you help pointing out the mistakes I have made in the code? Thanks so much.
Stock: APPL
Rules:
1) If Current Price > MA(30), Current Position == 0, Initiate long position with 10% of portfolio value. no. of shares = portfolio cash * 10% / current price.
2) Else If Current Price > MA(30), Current Position < 0. Flip the positions to long. i.e. number of shares after = -1*number of share before
3) Else If Current Price < MA(30), Current Position == 0. Initiate short position with 10% of portfolio value.
4) Else If Current Price < MA(30), Current Position > 0. Flip the positions to short.
5) Close all positions at 1550 EST.