Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Need Python Script Code

Please help me write my strategy in Python, I'm using Python 3.6.

Strategy

Stock Selection = Manually
Chart Setting = 15 mins Candlestick
Order Type = Cover Order
Stop Loss = As per ATR Trailing Stops

ATR Trailing Stops Value
Multiplier = 7
Period = 28

MACD values
Fast MA Period = 13
Slow MA Period = 30
Signal Period = 14

RSI Value
Period = 28
OverBought = 80
OverSold = 40

Buy when

  1. When MACD (13,30,14,Simple) is in Up Trend from past 30 days
  2. MACD (13,30,14,Simple) > MACD Signal MACD (13,30,14,Simple)
  3. MACD (13,30,14,Simple) > 0
  4. RSI > 80

Exit when
RSI < 80

Sell when

  1. when MACD (13,30,14,Simple) is in Down Trend from past 30 days
  2. MACD (13,30,14,Simple) < MACD Signal MACD (13,30,14,Simple)
  3. MACD (13,30,14,Simple) < 0
  4. RSI < 40

Exit when
RSI > 40

I've included everything in the strategy, Please write me an email if you need any other info.

Prashant Jain
[email protected]