Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 1010 Bytes

sample_rsi2.rst

File metadata and controls

29 lines (18 loc) · 1010 Bytes

RSI2

This example is based on a strategy known as RSI2 (http://stockcharts.com/school/doku.php?id=chart_school:trading_strategies:rsi2) which requires the following parameters:

  • An SMA period for trend identification. We’ll call this entrySMA.
  • A smaller SMA period for the exit point. We’ll call this exitSMA.
  • An RSI period for entering both short/long positions. We’ll call this rsiPeriod.
  • An RSI oversold threshold for long position entry. We’ll call this overSoldThreshold.
  • An RSI overbought threshold for short position entry. We’ll call this overBoughtThreshold.

Save this code as rsi2.py:

../samples/rsi2.py

and use the following code to execute the strategy:

../samples/rsi2_sample.py

This is what the output should look like:

../samples/rsi2_sample.output

and this is what the plot should look like:

image

You can get better returns by tunning the different parameters.