Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help me code my strategy.

Hi Everyone,

Strategy in Ninja Trader

*Buy Script
TREND(MACD(13, 26, 10, SIMPLE),30) = UP and (MACD(13, 26, 10,SIMPLE) > MACDSignal(13,26, 10, SIMPLE)) and (MACD(13, 26, 10,SIMPLE) > 0) and (Rsi(Close, 14) > 80)
Exit
RSI(CLOSE,14) < 80
Sell Script
TREND(MACD(13, 26, 10, SIMPLE),30) = DOWN and (MACD(13, 26, 10,SIMPLE) < MACDSignal(13,26, 10, SIMPLE)) and (MACD(13, 26, 10,SIMPLE) < 0) and (Rsi(Close, 14) < 45)
Exit
RSI(CLOSE,14) > 45*

I've written this strategy in Ninja Trader but not able to code it in Python for Algo-Trading. Please help me !!

Strategy Description

Stock Selection = Manually
Quantity = 1
Order Type = Cover Order

Chart Setting
1mins. Candlestick chart

MACD Values

FAST MA = 13
SLOW MA = 26
SIGNAL PERIOD = 10

RSI Value
14 Days
OverBought = 80
OverSold = 45

BUY when MACD is greater then MACD Signal line, MACD value is above 0 & RSI Value is above 80
Exit when RSI value goes below 80

SELL when MACD is smaller then MACD Signal line, MACD value is below 0 & RSI value is below 45
Exit when RSI value goes above 45

1 response

i'll give it a shot (or at least get a skeleton going that you, or someone else, can throw some meat on) ... and not to sound condescending bud, however the Quantopian tutorials really are gold -- I'm sure you spend less than one hour on them and the above should be feasible.

Tell me:
- Whats you investment universe?
- Order Type = Cover Order --> how is the stop loss determined? simple through distance? some % of equity at risk? some volatility factor of the underlying?
- leverage preference?
- when you say quantity =1, please clarify (...assuming equities are part of your potential universe as well)