From 4578d3de7f0954aee0157f0f4fb00fcd84a4db73 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Sat, 1 May 2021 04:26:48 +0100 Subject: [PATCH] Improve backtesting readme --- gamestonk_terminal/backtesting/README.md | 51 ++++++++++++------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/gamestonk_terminal/backtesting/README.md b/gamestonk_terminal/backtesting/README.md index 6a567e027e4..ee38b09b63a 100644 --- a/gamestonk_terminal/backtesting/README.md +++ b/gamestonk_terminal/backtesting/README.md @@ -1,53 +1,52 @@ # Backtesting -The goal of this menu is to allow super simple research into potential strategies. -We currently provides a couple basic options for starting with backtesting strategies. Note that this is currently just a -simple logic (i.e price comparisons). Obviously these strategies should not be used immediately and should be researched, -improved and further tested on your own. +This menu aims to apply backtesting strategies regarding a pre-loaded ticker, and the usage of the following commands along with an example will be exploited below. Note that this is currently just a simple logic (i.e price comparisons). These strategies should not be used immediately and should be researched, improved and further tested on your own. -The current implementation uses the [bt](#http://pmorissette.github.io/bt/index.html) library. +* [ema](#ema) + * buy when price exceeds EMA(l) +* [ema_cross](#ema_cross) + * buy when EMA(short) > EMA(long) +* [rsi](#rsi) + * buy when RSI < low and sell when RSI > high -Current strategies are: -* [Simple EMA](#SimpleEMA) - * Buys the stock when `price > EMA(l)` - -* [EMA Cross](#EMA Cross) - * Buys when EMA(short) > EMA(long) and sells when the opposite is true - -* [RSI](#RSI) - * Momentum strategy that longs when RSI < threshold (oversold) and shorts when +NOTE: The current implementation uses the [bt](#http://pmorissette.github.io/bt/index.html) library. -### SimpleEMA -This strategy buys when price > EMA(l) +### ema ```` usage: ema [-l] [--spy] [--no_bench] ```` + +This strategy buys when price > EMA(l). * -l: Period of EMA to use. Default = 20. * [--spy]: Flag that overlays the results if you buy and hold SPY * [--no_bench]: Flag that removes the benchmark comparison of just buy and hold the stock. -im: +![ema](https://user-images.githubusercontent.com/25267873/116769584-1eb37c80-aa35-11eb-898b-efa36d4a8f5c.png) +ema2 -### EMA Cross -This strategy goes long when EMA(short) > EMA(long) and goes short when -EMA(short) < EMA(long). I provide the option to go long only through the --no_short flag +### ema_cross ```` usage: ema_cross [-l] [-s] [--spy] [--no_bench] [--no_short] ```` + +This strategy goes long when EMA(short) > EMA(long) and goes short when EMA(short) < EMA(long). It provides the option to go long only through the --no_short flag. * -l/--long: Long period of EMA to use. Default = 50. * -s/--short: Short period of EMA to use. Default = 20. * [--spy]: Flag that overlays the results if you buy and hold SPY * [--no_bench]: Flag that removes the benchmark comparison of just buy and hold the stock. * [--no_short]: Flag that removes the shortable option. Will just be long positions when short > long EMAs. -im -### RSI -This strategy goes long when the RSI is "oversold" - defined as the low parameter. It goes short when -the RSI is "overbought" - defined as the high (upper) parameter +![ema_cross](https://user-images.githubusercontent.com/25267873/116769581-1ce9b900-aa35-11eb-85e9-133b3c0b09ad.png) +ema_cross2 + + +### rsi ```` usage: rsi [-u] [-l] [-p] [--spy] [--no_bench] [--no_short] ```` + +This strategy goes long when the RSI is "oversold" - defined as the low parameter. It goes short when the RSI is "overbought" - defined as the high (upper) parameter * -u/--high: High (upper) value to consider overbought. Default = 70 * -s/--short: Short period of EMA to use. Default = 30 * -p/--periods: Periods to use for RSI calculation. Default = 14. @@ -55,5 +54,5 @@ usage: rsi [-u] [-l] [-p] [--spy] [--no_bench] [--no_short] * [--no_bench]: Flag that removes the benchmark comparison of just buy and hold the stock. * [--no_short]: Flag that removes the shortable option. Will just be long positions when short > long EMAs. - - +![rsi](https://user-images.githubusercontent.com/25267873/116769576-19eec880-aa35-11eb-9e60-f77a31e51db0.png) +rsi2