Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Latest commit

 

History

History
68 lines (48 loc) · 4.87 KB

strategy_forex_analytics.md

File metadata and controls

68 lines (48 loc) · 4.87 KB

Strategy: forex_analytics

The forex_analytics is based on forex.analytics by mkmarek:

The result of technical analysis are two binary trees describing strategies for buy and sell signals which produced profit in a certain period of time specified by the input OHLC data set [i.e. candlesticks].

In a nutshell, the genetic optimization algorithm used by forex.analytics permutates thresholds used for a limited set of TA-Lib indicators to build a decision tree of different parameters and thresholds, which then result in either a buy or sell signal. In the end, different combinations of parameters and thresholds are used for either a buy or sell decision.

Please also refer to https://github.com/mkmarek/forex.analytics/blob/master/README.md.

Training

The strategy comes with a new train command to train a model on backfilled data. It is recommended to train the model first on a large training dataset and then test the model on previously unseen data to evaluate performance and potential overfitting. This can be done by the train command, e.g.

./zenbot.sh train bitfinex.ETH-USD --days_training 42 --days_test 14

You can specify the following parameters for training:

--conf <path>                               path to optional conf overrides file
--period <value>                            period length of a candlestick (default: 30m)
--start_training <timestamp>                start training at timestamp
--end_training <timestamp>                  end training at timestamp
--days_training <days>                      set duration of training dataset by day count
--days_test <days>                          set duration of test dataset to use with simulation, appended AFTER the training dataset (default: 0)
--populationCount <value>                   population count (default: 100)
--generationCount <value>                   generation count (default: 100)
--selectionAmount <value>                   selection amount (default: 10)
--leafValueMutationProbability <value>      leaf value mutation probability (default: 0.5)
--leafSignMutationProbability <value>       leaf sign mutation probability (default: 0.3)
--logicalNodeMutationProbability <value>    logical node mutation probability (default: 0.3)
--leafIndicatorMutationProbability <value>  leaf indicator mutation probability (default: 0.2)
--crossoverProbability <value>              crossover probability (default: 0.03)
--indicators <value>                        comma separated list of TA-lib indicators (default: CCI,MACD,RSI,SAR,Stochastic, available: ATR,BOP,CCI,MACD,MACD_Signal,MACD_Histogram,Momentum,RSI,SAR,SMA15_SMA50,Stochastic)
-h, --help                                  output usage information

You'll have to play around with the different settings for the genetic optimization algorithm, because we're also still in the process of learning them.

The train command first generates the raw candlestick data, performs the training, saves the model to a temporary file and runs the simulations on the training and test dataset.

You should expect that the training dataset shows extremely good results, since the model has been tailored to it. The results from the test dataset therefore show a more realistic picture. Do choose a large enough test dataset using --days_test.

The model, along with the HTML simulation results of both training and test dataset, are then saved to the models/ folder.

Trading

You can use the trained model for trading using the normal trade command:

./zenbot.sh trade bitfinex.ETH-USD --strategy forex_analytics --modelfile models/trained_model_file.json --paper

There are not many options to specify. Usually, you only need to adapt --modelfile and --period. The period must be the same as in training/testing and zenbot will complain if it is not.

Please note that you can share the model JSON files. zenbot is Open Source, we do share. When you find the holy model grail, please give back to the community ;)

forex_analytics
  description:
    Apply the trained forex analytics model.
  options:
    --modelfile=<value>  modelfile (generated by running `train`), should be in models/ (default: none)
    --period=<value>  period length of a candlestick (default: 30m) (default: 30m)
    --min_periods=<value>  min. number of history periods (default: 100)

Limitations

  • Please be aware that you're fitting the model to retrospective data of a single exchange. There might be (a lot of) overfitting. As discussed, please use a large enough test dataset.
  • The original forex.anayltics does not optimize for the length of the lookback periods for the TA-Lib indicators. This still needs work. We filed an issue, but the project seems to be idle - a pull request would be highly appreciated.