Skip to content

Latest commit

 

History

History
535 lines (456 loc) · 48 KB

MGM_DOCUMENTATION.md

File metadata and controls

535 lines (456 loc) · 48 KB

Join CryptoStonksShallRise on Discord Total Releases Downloaded from GitHub Latest Official Release on GitHub GNU General Public License The current place where you can find all MoniGoMani Documentation! Freqtrade - The open source crypto day-trading bot ICONOMI - The world’s largest crypto strategy provider Buy me a Coffee as a way to sponsor this project!

⚠️ Disclaimer

  • This strategy is under development. It is not recommended running it live at this moment.
  • Always test this strategy before using it!
  • I am in no way responsible for your live results! This strategy is still experimental and under heavy development!
  • MoniGoMani should always be re-optimized after doing manual changes!
  • You need to optimize your own copy of MoniGoMani while thinking logically, don't follow your computer blindly!

Table of Contents

Freqtrade Installation

This guide now assumes you have Freqtrade and jq already installed, if you haven't yet, then please see VERYQUICKSTART_FREQTRADE.md

How to Optimize MoniGoMani

(These are just my ideas/theories, if you have other ideas, please test them & report your results to #moni-go-mani-testing so we can learn and improve this flow!)
WARNING: It's strongly advised to not do any manual alterations to an already optimized MGM setup! The recommended way to do manual alterations is by Configuring MoniGoMani, and then following this optimization process to apply them!

  1. Delete the previous mgm-config-hyperopt.json if it exists using:
    rm ./user_data/mgm-config-hyperopt.json
  2. Setup your MoniGoMani by following How to Configure MoniGoMani
  3. Download a good Top Volume StaticPairList and update this in your mgm-config.json. Instructions for how to do this are under PairLists.
  4. Do some Technical Analysis on how the global crypto market has been behaving in the last months/weeks & pick a logical timeframe to do your HyperOpt upon (The timeframe in the go-to commands for example resembles some bullish rise/correction cycles & I believe 2021 will be a bullish year thus I think it's a good timeframe to test upon).
  5. HyperOpt for a 1st HyperOpt Run with the command provided in the Go-To Commands (Free to alter the command if you have a good idea that you want to test)
    The 1st HyperOpt Run (When no mgm-config-hyperopt.json exists) is automatically ran with the default open search spaces ranging between the default min_ & max_ values provided under the monigomani_settings section of mgm-config.json
  6. Reflect over your HyperOpt results! The computer just tries to get certain values high (profits) and others low (losses), without a true understanding of their meaning. Because of this HyperOpt is prone to profit exploitation which would be no good when used Live. That's why you need to make yourself familiar with possible BackTesting-Traps. Only then you can tell which results would make sense and would be any good when used Live.
    You can check a certain epoch in the list of best results using:
    freqtrade hyperopt-show -n <epoch of choice>
  7. Once you picked an <epoch of choice> of which you feel confident, then apply the HyperOpt results by extracting them into a new mgm-config-hyperopt.json using:
    freqtrade hyperopt-show -n <epoch of choice> -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json --no-header --print-json | tail -n 1 | jq '.' > ./user_data/mgm-config-hyperopt.json
  8. Repeat Steps 4 and 5 at least for a 2nd HyperOpt Run with the command provided in the Go-To Commands (Free to alter the command if you have a good idea that you want to test) The 2nd HyperOpt Run (When a mgm-config-hyperopt.json exists) is automatically ran with:
    - Refined search spaces ranging between the values found during the 1st Run (Loaded from mgm-config-hyperopt.json) plus their search_threshold_ and minus their search_threshold_ values provided under the monigomani_settings section of mgm-config.json (This is done to push the next HyperOpt run back in the direction that we already had going during the 1st HyperOpt run)
    - Weak weighted signals weeded out by overriding them to their respective min_ value (Signals of which the found value is below their default min_ + search_threshold_ values provided under the monigomani_settings section of mgm-config.json)
    - Strong weighted signals are boosted by overriding them to their respective max_ value (Signals of which the found value is above their default max_ - search_threshold_ values provided under the monigomani_settings section of mgm-config.json)
  9. Once you picked an <epoch of choice> of which you feel confident, then apply the HyperOpt results by extracting them and combining them in the pre-existing mgm-config-hyperopt.json using:
    freqtrade hyperopt-show -n <epoch of choice> -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json --no-header --print-json | tail -n 1 | jq '.' > ./tmp.json && jq -s '.[0] * .[1]' ./user_data/mgm-config-hyperopt.json ./tmp.json > ./user_data/mgm-config-hyperopt.json && rm ./tmp.json
  10. Load your results into the Total-Overall-Signal-Importance-Calculator.py and run it's Go-To Command to receive a nice weighted signal report for sharing in the Discord server and to pull conclusions from.

How to Configure MoniGoMani

In total 5 files are used in the configuration of MoniGoMani, all can be found in the user_data & user_data/strategies folders:

mgm-config.json

Link to: mgm-config.json
The main MoniGoMani settings can be found under monigomani_settings:

Parameter(s) Description
timeframe
backtest_timeframe
These values configure the timeframes used in MoniGoMani.
Documentation: TimeFrame-Zoom
Datatypes: Integer
startup_candle_count Number of candles the strategy requires before producing valid signals during BackTesting/HyperOpting.
By default this is set to 400 since MoniGoMani uses a 200EMA, which needs 400 candles worth of data to be calculated.
Datatype: Integer
precision This value can be used to control the precision of HyperOpting. Default is 1.
Documentation: Precision Setting
Datatype: Integer
roi_table_step_size MoniGoMani generates a really long custom ROI-Table (Return of Interest), so it will have fewer gaps in it and be more continuous in it's decrease.
This setting alters the size of the steps (in minutes) to be used when calculating the long continuous ROI-Table.
Datatype: Integer
trading_during_trends The settings inside the trading_during_trends section are used to configure during which trends (Downwards/Sideways/Upwards) MGM will be allowed to trade (for Buys/Sells).
Documentation: Trading During Trends
Datatype: Dictionary
weighted_signal_spaces The settings inside the weighted_signal_spaces section are used to control how MGM handles the HyperOpting of (Total) Weighted Signal Values during it's optimization process.
Documentation: Weighted Signal Spaces
Datatype: Dictionary
stoploss_spaces The settings inside the stoploss_spaces section are used to refine the search spaces that MGM will use for the (trailing) stoploss during it's optimization process.
Documentation: Stoploss Spaces
Datatype: Dictionary
unclogger_spaces The settings inside the unclogger_spaces section are used to refine the search spaces that MGM will use for the open trade unclogger during it's optimization process.
Documentation: Open Trade Unclogger
Datatype: Dictionary
default_stub_values The settings inside the default_stub_values section are only used to control some default startup values that MGM will use when no other values are found and/or used for them.
Documentation: Default Stub Values
Datatype: Dictionary
debuggable_weighted_signal_dataframe If set to True all Weighted Signal results will be added to the dataframe for easy debugging with BreakPoints.
WARNING: Disable this for anything else then debugging in an IDE! (Integrated Development Environment)
Datatype: Boolean
use_mgm_logging If set to True MoniGoMani logging will be displayed to the console and be integrated in Freqtrades native logging, further logging configuration can be done by setting individual mgm_log_levels_enabled.
It's recommended to set this to False for HyperOpting/BackTesting unless you are testing with breakpoints.
Datatype: Boolean
mgm_log_levels_enabled It allows turning on/off individual info, warning, error and debug logging
For Live Runs it's recommended to disable at least info and debug logging, to keep MGM as lightweight as possible!
debug is very verbose! Always set it to False when BackTesting/HyperOpting!
Datatype: Dictionary

TimeFrame-Zoom

To prevent profit exploitation during BackTesting/HyperOpting we BackTest/HyperOpt MoniGoMani using TimeFrame-Zoom. When normally a timeframe (1h candles) would be used, you can zoom in using a smaller backtest_timeframe (5m candles) instead. This happens while still using an informative_timeframe (original 1h candles) to generate the buy/sell signals.

With this more realistic results should be found during BackTesting/HyperOpting. Since the buy/sell signals will operate on the same timeframe that Live would use (1h candles), while at the same time backtest_timeframe (5m or 1m candles) will simulate price movement during that timeframe (1h candle), providing more realistic trailing stoploss and ROI behavior during BackTesting/HyperOpting.
If you haven't yet please read: BackTesting-Traps

WARNING: To disable TimeFrame-Zoom just use the same candles for timeframe & backtest_timeframe
WARNING: Candle data for both timeframe as backtest_timeframe will have to be downloaded before you will be able to BackTest/HyperOpt! (Since both will be used)
WARNING: This will be slower than BackTesting at 1h and 1m is a CPU killer. If you plan on using trailing stoploss or ROI, you probably want to know that your BackTest results are not complete lies.

TimeFrame-Zoom Examples

Parameter Description
timeframe='1h' TimeFrame used during Dry/Live-runs
backtest_timeframe='5m' Zoomed in TimeFrame used during BackTesting/HyperOpting

Precision Setting

The precision setting can be used to control the precision / step size used during HyperOpting.
A value smaller than 1 will limit the search space, but may skip over good values.
While a value larger than 1 increases the search space, but will increase the duration of HyperOpting.
To disable precision / for normal work mode just use 1.

WARNING: Only use a precision different from 1 during HyperOpting & restore to 1 afterwards!
WARNING: HyperOpt Results don't take precision into consideration, after HyperOpting with precision use the Total Overall Signal Importance Calculator's --precision-used subcommand to fix the results

Precision Examples

Precision Value Step Size effectively used during HyperOpting
1/5 or 0.2 5 (0, 5, 10 ...)
5 1/5 or 0.2 (0, 0.2, 0.4, 0.8, ...)

Trading During Trends

The settings inside mgm-config.json's trading_during_trends section are used to configure during which trends (Downwards/Sideways/Upwards) MGM will be allowed to trade (for Buys/Sells).

Parameter Description
buy_trades_when_downwards Enable or completely disable the buying of new trades during downwards trends.
Datatype: Boolean
buy_trades_when_sideways Enable or completely disable the buying of new trades during sideways trends.
Datatype: Boolean
buy_trades_when_upwards Enable or completely disable the buying of new trades during upwards trends.
Datatype: Boolean
sell_trades_when_downwards Enable or completely disable the selling of open trades (through normal sell signals) during downwards trends.
Datatype: Boolean
sell_trades_when_sideways Enable or completely disable the selling of open trades (through normal sell signals) during sideways trends.
Datatype: Boolean
sell_trades_when_upwards Enable or completely disable the selling of open trades (through normal sell signals) during upwards trends.
Datatype: Boolean

Weighted Signal Spaces

The settings inside mgm-config.json's weighted_signal_spaces section are used to control how MGM handles the HyperOpting of (Total) Weighted Signal Values during it's optimization process.

Parameter Description
min_weighted_signal_value 1st HyperOpt Run: Minimal value used in the HyperOpt Space for weighted signals.
2nd HyperOpt Run: Weak weighted signals are weeded out by overriding them to their respective Minimal value.
Datatype: Integer
max_weighted_signal_value 1st HyperOpt Run: Maximum value used in the HyperOpt Space for weighted signals.
2nd HyperOpt Run: Strong weighted signals are boosted by overriding them to their respective Maximum value.
Datatype: Integer
min_trend_total_signal_needed_value 1st HyperOpt Run: Minimal value used in the HyperOpt Space for total weighted signals needed.
Datatype: Integer
min_trend_total_signal_needed_candles_lookback_window_value 1st HyperOpt Run: Minimal value used in the HyperOpt Space for the candle lookback window for total signals needed.
Datatype: Integer
max_trend_total_signal_needed_candles_lookback_window_value 1st HyperOpt Run: Minimal value used in the HyperOpt Space for the candle lookback window for total signals needed.
Datatype: Integer
search_threshold_weighted_signal_values 2nd HyperOpt Run: Used to refine the search spaces for remaining weighted signals with the value found in the 1st run +- the threshold.
Datatype: Integer
search_threshold_trend_total_signal_needed_candles_lookback_window_value 2nd HyperOpt Run: Used to refine the search spaces for the candle lookback window for total signals needed with the values found in the 1st run +- the threshold.
Datatype: Integer
number_of_weighted_signals Set the number_of_weighted_signals setting to the total number of different weighted signals in use in the weighted tables.
buy/sell__downwards/sideways/upwards_trend_total_signal_needed settings will be multiplied with this value, so their search spaces will be larger, resulting in more equally divided total weighted signal scores when HyperOpting.
Datatype: Integer

Stoploss Spaces

The settings inside mgm-config.json's stoploss_spaces section are used to refine the search spaces that MGM will use for the (trailing) stoploss during it's optimization process.

Parameter Description
stoploss_min_value Minimal value used in the HyperOpt Space for the stoploss.
Datatype: Decimal
stoploss_max_value Maximum value used in the HyperOpt Space for the stoploss.
Datatype: Decimal
trailing_stop_positive_min_value Minimal value used in the HyperOpt Space for the trailing_stop_positive.
Datatype: Decimal
trailing_stop_positive_max_value Maximum value used in the HyperOpt Space for the trailing_stop_positive.
Datatype: Decimal
trailing_stop_positive_offset_min_value Minimal value used for the intermediate offset parameter used to calculate the HyperOpt Space for the trailing_stop_positive_offset.
Datatype: Decimal
trailing_stop_positive_offset_max_value Maximum value used for the intermediate offset parameter used to calculate the HyperOpt Space for the trailing_stop_positive_offset.
Datatype: Decimal

Open Trade Unclogger

When the Open Trade Unclogger is enabled it attempts to unclog the bot when it's stuck with losing trades & unable to trade more new trades.
This custom_sell() function should be able to work in tandem with Trailing stoploss.

It will only unclog a losing trade when all following checks have been full-filled (If a check is set to 0 it will be taken out of the equation, thus the unclogger will continue checking further without it):

  • Check if there is no buy or sell signal already occurring on the current candle.
  • Check if sell___unclogger_enabled is True, otherwise abort further unclogger logic.
  • Check if everything in custom_storage is up to date with all_open_trades
  • Check if there are enough losing trades open to fulfil sell___unclogger_minimal_losing_trades_open
  • Check if there is a losing trade open for the pair currently being run through the MoniGoMani loop
  • Check if trade has been open for sell___unclogger_minimal_losing_trade_duration_minutes (long enough to give it a recovery chance)
  • Check if sell___unclogger_open_trades_losing_percentage_needed is fulfilled
  • Check if open_trade's trend changed negatively during past sell___unclogger_trend_lookback_candles_window:
    For unclogging to occur sell___unclogger_trend_lookback_candles_window_percentage_needed should be fulfilled!
    The trends used for the calculations in this check can be configured with sell___unclogger_trend_lookback_window_uses_downwards/sideways/upwards_candles=True/False).
    Each candle fulfilling a trend set to True will be added in the sum used to calculate the value for sell___unclogger_trend_lookback_candles_window_percentage_needed if it is found in the lookback window.

The settings inside mgm-config.json's unclogger_spaces section are used to configure the Open Trade Unclogger:

Parameter Description
unclogger_enabled Enable or completely disable the open trade unclogger.
Datatype: Boolean
unclogger_minimal_losing_trade_duration_minutes Settings to configure the HyperOpt Space for the minimal duration needed (in minutes) before the unclogger is allowed to attempt to unclog the open trade.
Documentation: Unclogger Sub Dictionaries
Datatype: Dictionary
unclogger_minimal_losing_trades_open Settings to configure the HyperOpt Space for the minimal losing trades open before the unclogger is allowed to attempt to unclog the open trade.
Documentation: Unclogger Sub Dictionaries
Datatype: Dictionary
unclogger_open_trades_losing_percentage_needed Settings to configure the HyperOpt Space for the minimal percentage of losing open trades before the unclogger is allowed to attempt to unclog the open trade.
Documentation: Unclogger Sub Dictionaries
Datatype: Dictionary
unclogger_trend_lookback_candles_window Settings to configure the HyperOpt Space for the lookback window use by the unclogger_trend_lookback_candles_window_percentage_needed check.
Documentation: Unclogger Sub Dictionaries
Datatype: Dictionary
unclogger_trend_lookback_candles_window_percentage_needed Settings to configure the HyperOpt Space for the minimal percentage of bad trends that needs to be detected inside the lookback window before the unclogger is allowed to attempt to unclog the open trade.
Documentation: Unclogger Sub Dictionaries
Datatype: Dictionary
unclogger_trend_lookback_window_uses_downwards_candles Enable or completely disable the open trade unclogger from seeing downwards trends as bad in it's lookback window.
Datatype: Boolean (true = bad)
unclogger_trend_lookback_window_uses_sideways_candles Enable or completely disable the open trade unclogger from seeing sideways trends as bad in it's lookback window.
Datatype: Boolean (true = bad)
unclogger_trend_lookback_window_uses_upwards_candles Enable or completely disable the open trade unclogger from seeing upwards trends as bad in it's lookback window.
Datatype: Boolean (true = bad)

Unclogger Sub Dictionaries

Parameter Description
min 1st HyperOpt Run: Minimal value used in the HyperOpt Space for the unclogger setting at hand.
2nd HyperOpt Run: Value remains unused and refined search spaces are applied based on the value loaded from mgm-config-hyperopt.json.
Datatype: Integer
max 1st HyperOpt Run: Maximum value used in the HyperOpt Space for the unclogger setting at hand.
2nd HyperOpt Run: Value remains unused and refined search spaces are applied based on the value loaded from mgm-config-hyperopt.json.
Datatype: Integer
threshold (Optional parameter) 2nd HyperOpt Run:** If this setting is found, then it's used to refine the search spaces based on the value found in the 1st run ± the threshold. If no custom threshold is provided then the search_threshold_weighted_signal_values is used instead.
Datatype: Integer

Default Stub Values

The settings inside mgm-config.json's default_stub_values section are only used to control some default startup values that MGM will use when no other values are found and/or used for them.
(These would be used when not HyperOpting --spaces all in one go and/or during the initialization of MGM's variables in the 1st HyperOpt Run)

Parameter Description
minimal_roi Official Freqtrade Documentation: Understand minimal_roi
Datatype: Dictionary
stoploss Official Freqtrade Documentation: Stop Loss
Datatype: Decimal
trailing_stop Official Freqtrade Documentation: Trailing Stop Loss
Datatype: Boolean
trailing_stop_positive Official Freqtrade Documentation: Trailing stop loss, custom positive loss
Datatype: Decimal
trailing_stop_positive_offset Official Freqtrade Documentation: Trailing stop loss only once the trade has reached a certain offset
Datatype: Decimal
trailing_only_offset_is_reached Official Freqtrade Documentation: Trailing stop loss only once the trade has reached a certain offset
Datatype: Boolean

mgm-config-hyperopt.json

This file contains the optimized HyperOptable MoniGoMani and Freqtrade settings. It will be created when following the How to Optimize MoniGoMani process and its one of the main files that will define your MGM configuration when moving to dry/live-run mode.

It's truly important that you reflect over these files in between HyperOpt Runs.

Reflect over HyperOpt Results

Please read BackTesting-Traps to learn about the common traps that can occur in your HyperOpt results.

Further you want to confirm that your total signals needed are reasonable/possible. The sum of all weighted buy/sell signals found in a trend should always be bigger then the respective total signal needed!

Following equation should always be true:

Bad Weighted signal setup examples

Impossible to reach:
Imagine following configuration for buy on upwards trends:

{
    "buy__upwards_trend_total_signal_needed": 542,
    "buy__upwards_trend_total_signal_needed_candles_lookback_window": 1,
    "buy_upwards_trend_adx_strong_up_weight": 54,
    "buy_upwards_trend_bollinger_bands_weight": 9,
    "buy_upwards_trend_ema_long_golden_cross_weight": 70,
    "buy_upwards_trend_ema_short_golden_cross_weight": 85,
    "buy_upwards_trend_macd_weight": 67,
    "buy_upwards_trend_rsi_weight": 7,
    "buy_upwards_trend_sma_long_golden_cross_weight": 47,
    "buy_upwards_trend_sma_short_golden_cross_weight": 19,
    "buy_upwards_trend_vwap_cross_weight": 11
}

Here we are working with a lookback window of only 1 candle, this means that all signals counting up for the total needed should occur in the current candle.

If we calculate the sum of all weighted signals, we will see that even if all signals would trigger, that it still won't be enough to reach the total signal needed! Meaning that this MGM configuration will never be able to buy in this trend.

Sum of all weighted signals: 54 + 9 + 70 + 85 + 67 + 7 + 47 + 19 + 11 = 369

Way too low total needed:
Imagine following configuration for buy on upwards trends:

{
    "buy__upwards_trend_total_signal_needed": "33",
    "buy__upwards_trend_total_signal_needed_candles_lookback_window": "2",
    "buy_upwards_trend_adx_strong_up_weight": "79",
    "buy_upwards_trend_bollinger_bands_weight": "97",
    "buy_upwards_trend_ema_long_golden_cross_weight": "74",
    "buy_upwards_trend_ema_short_golden_cross_weight": "91",
    "buy_upwards_trend_macd_weight": "53",
    "buy_upwards_trend_rsi_weight": "17",
    "buy_upwards_trend_sma_long_golden_cross_weight": "32",
    "buy_upwards_trend_sma_short_golden_cross_weight": "100",
    "buy_upwards_trend_vwap_cross_weight": "58",
}

Here we are working with a lookback window of 2 candles, this means that all signals counting up for the total needed may occur in the current candle and the candle before that, but each signal is only allowed to fire off once.

If we calculate the sum of all weighted signals, we will see that its way above te total signal needed! Meaning that this MGM configuration will probably try to buy too much candles than need during this trend.

Sum of all weighted signals: 79 + 97 + 74 + 91 + 53 + 17 + 32 + 100 + 58 = 601

MoniGoManiHyperStrategy

This is the main strategy file used by MoniGoMani, containing the Weighted Signal Interface.

Link to: MoniGoManiHyperStrategy.py

Weighted Signal Interface

With this you can easily define new indicators and weighted signals that will be used by MGM.
(We'll only use RSI and MACD in below examples to keep things simple)

Defining Indicators Examples

First add the technical analysis indicators you wish to use to MGM's do_populate_indicators() function.
Checkout the TA-Lib Python Wrapper - Indicators and Functions Documentation to get an idea of what is possible with TA-Lib. But feel free to look for other means of implementing indicators too.

def do_populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
    """
    Generate all indicators used by MoniGoMani
    """
    # MACD - Moving Average Convergence Divergence
    macd = ta.MACD(dataframe)
    dataframe['macd'] = macd['macd']  # MACD - Blue TradingView Line (Bullish if on top)
    dataframe['macdsignal'] = macd['macdsignal']  # Signal - Orange TradingView Line (Bearish if on top)

    # RSI - Relative Strength Index (Under bought / Over sold & Over bought / Under sold indicator Indicator)
    dataframe['rsi'] = ta.RSI(dataframe)

    return dataframe

Defining Weighted Buy & Sell Signals Examples

Secondly define the Weighted signal conditions you wish to use in MGM's buy_signals and sell_signals dictionaries by using the names of the indicators you just defined in the examples above.

# Define the Weighted Buy Signals to be used by MGM
buy_signals = {
    # Weighted Buy Signal: MACD above Signal
    'macd': lambda df: (df['macd'] > df['macdsignal']),
    # Weighted Buy Signal: RSI crosses above 30 (Under-bought / low-price and rising indication)
    'rsi': lambda df: (qtpylib.crossed_above(df['rsi'], 30))
}

# Define the Weighted Sell Signals to be used by MGM
sell_signals = {
    # Weighted Sell Signal: MACD below Signal
    'macd': lambda df: (df['macd'] < df['macdsignal']),
    # Weighted Sell Signal: RSI crosses below 70 (Over-bought / high-price and dropping indication)
    'rsi': lambda df: (qtpylib.crossed_below(df['rsi'], 70))
}

Visualize Weighted Signals in FreqUI

Finally you can easily define your freshly implemented indicators inside the plot_config dictionary for visualization in FreqUI. Then you can easily read when which weighted signals triggered.

plot_config = {
        'main_plot': {
            # Add indicators here which you'd like to see in the main graph
        },
        'subplots': {
            # Subplots - Each dict defines one additional plot (MACD, ADX, Plus/Minus Direction, RSI)
            'MACD (Moving Average Convergence Divergence)': {
                'macd': {'color': '#19038a'},
                'macdsignal': {'color': '#ae231c'}
            },
            'RSI (Relative Strength Index)': {
                'rsi': {'color': '#7fba3c'}
            }
        }
}

For more documentation about defining these see the Official Freqtrade Documentation: Advanced Plot Configuration

Once you defined them you can load them in FreqUI as following:

  1. Click the cog-wheel at the right top
    Click the cog-wheel at the right top
  2. Click Load from strategy
    Click Load from strategy
  3. Give it a name (like MoniGoManiPlot) Click Save
    Give it a name (like MoniGoManiPlot) Click Save
  4. Now you will be able to select and view your saved plot in FreqUI! (Individual indicators can be toggled on/off by clicking on them in the header on top)
    Final Result

Total Overall Signal Importance Calculator

Execute: python ./user_data/mgm_tools/Total-Overall-Signal-Importance-Calculator.py from your favorite terminal / CLI to calculate the overall importance of the signals being used.
The higher the score of a signal the better! It will also export to a ./user_data/Total-Average-Signal-Importance-Report.log file for easy sharing!
Share these results in #moni-go-mani-testing so we can improve the signals!

The calculator file also has 2 settings you can configure marked under the CONFIG NAMES SECTION section inside the file: - mgm_config_name: Provide a custom file name for mgm-config.json - mgm_config_hyperopt_name: Provide a custom file name for mgm-config-hyperopt.json

Handy Calculator Sub Commands

  • -h or --help: Print out information about the usage of all sub commands.
  • -pu or --precision-used Optional (Defaults to 1 when not omitted): The precision value used during HyperOpt. Can be decimal (0.2) or fraction 1/5. Mostly useful after a running a HyperOpt with precision different from 1, used to patch the weights of the signals displayed in the report to what we would expect them to be for comparison with other results.
  • -cf or --create-file Optional (Unused by default): Save the Total-Average-Signal-Importance-Report as a .log file with a custom filename and file output location
  • -nf or --no-file Optional (Defaults to True when not omitted): Do not output the Total-Average-Signal-Importance-Report as a .log file

Custom HyperLoss Functions

MoniGoMani comes with an extra set of loss functions for HyperOpting, supplementing the ones shipped with FreqTrade. You can find these functions in M̀oniGoMani/user_data/hyperopts/, and can use them by overriding the freqtrade HyperOpt parameter --hyperopt-loss.

Following 2 Custom HyperLoss Functions ship with the MoniGoMani Framework:

  • WinRatioAndProfitRatioLoss: Attempts to optimise for the best profit and stability (Returns smaller number for better results)
  • UncloggedWinRatioAndProfitRatioLoss: Same as WinRatioAndProfitRatioLoss but has a configurable Percentage of loss (See unclogger_profit_ratio_loss_tolerance setting inside the file) to ignore while HyperOpting (Since small losses are a by-product of the Unclogger)

Example Usage:

--hyperopt-loss WinRatioAndProfitRatioLoss

PairLists

By default, MoniGoMani includes 2 pairlists in mgm-config.json:

  • A VolumePairList:
    • Best to use for Dry and Live Running
    • Will automatically update to the current best top volume coin pairs available
  • A StaticPairList:
    • Used for BackTesting / HyperOpting since a VolumePairList cannot be used here.
    • When optimizing MoniGoMani for actual Dry/Live-running (instead of testing) it's truly recommended to download a fresh top volume StaticPairList and HyperOpt upon that (Preferably as big as possible, but beware of the warning below)!
      This should yield much better & more realistic results during HyperOpting/BackTesting!
      This is due to giving a better reflection of the current market and being closer to the VolumePairList used during Dry/Live-run's.

Switching between the PairList in use can easily be done by moving the _ in front of the pairlists value inside mgm-config.json for the pairlist you wish to disable.

WARNING: The bigger the (Volume/Static)PairList in use the higher the system requirements (CPU usage, RAM usage & Time needed to HyperOpt will go up)! Switch to a smaller list if your system can't handle it!

Enabled StaticPairList / Disabled VolumePairList Example

"pairlists": [{
        "method": "StaticPairList"
    }],
"_pairlists": [
    {
        "method": "VolumePairList",

Download StaticPairLists

Retrieve and apply a current Binance-USDT-Top-Volume-StaticPairList.json file (using Binance-Retrieve-Top-Volume-StaticPairList.json) (The amount of pairs in these top volume lists can be altered by opening up Binance-Retrieve-Top-Volume-StaticPairList.json and changing the number_assets value near the bottom of the file to the amount of pairs you'd like in your list. Further you can also change the min_days_listed to make sure that all downloaded pairs where available for the duration of your whole HyperOpt timerange):

freqtrade test-pairlist -c ./user_data/mgm_tools/Binance-Retrieve-Top-Volume-StaticPairList.json --quote USDT --print-json | tail -n 1 | jq '.|{exchange: { pair_whitelist: .}}' > ./user_data/mgm_pair_lists/Binance-USDT-Top-Volume-StaticPairList.json && jq 'del(.exchange.pair_whitelist )' ./user_data/mgm-config.json > ./tmp.json && jq -s '.[0] * .[1]' ./tmp.json ./user_data/mgm_pair_lists/Binance-USDT-Top-Volume-StaticPairList.json > ./user_data/mgm-config.json && rm ./tmp.json && jq '.' ./user_data/mgm-config.json

Retrieve and apply a current Binance-USDT-All-Tradable-StaticPairList.json file (using Binance-Retrieve-All-Tradable-StaticPairList.py) (Beware, can be very high system requirements due to a lot of pairs!):

python ./user_data/mgm_tools/Binance-Retrieve-All-Tradable-StaticPairList.py -q USDT | jq '.|{exchange: { pair_whitelist: . }}' > ./user_data/mgm_pair_lists/Binance-USDT-All-Tradable-StaticPairList.json && jq 'del(.exchange.pair_whitelist )' ./user_data/mgm-config.json > ./tmp.json && jq -s '.[0] * .[1]' ./tmp.json ./user_data/mgm_pair_lists/Binance-USDT-All-Tradable-StaticPairList.json > ./user_data/mgm-config.json && rm ./tmp.json && jq '.' ./user_data/mgm-config.json

After Downloading the StaticPairList automatically applied to ./user_data/mgm-config.json. There will also be a copy available under ./user_data/mgm_pair_lists/<<NAME_HERE>>-StaticPairList.json!

Don't forget to Download Candle Data before HyperOpting or BackTesting (Example timerange):

freqtrade download-data --timerange 20201201-20210316 -t 5m 1h -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json

Go-To Commands

Hyper Opting MoniGoManiHyperStrategy.py:

freqtrade hyperopt -s MoniGoManiHyperStrategy -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json --hyperopt-loss WinRatioAndProfitRatioLoss --spaces all -e 800 --timerange 20210101-20210316 --enable-protections

Apply HyperOpt Results after Run 1 from a <epoch of choice>:

freqtrade hyperopt-show -n <epoch of choice> -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json --no-header --print-json | tail -n 1 | jq '.' > ./user_data/mgm-config-hyperopt.json && jq '.' ./user_data/mgm-config-hyperopt.json

Apply HyperOpt Results after Run 2 from a <epoch of choice>:

freqtrade hyperopt-show -n <epoch of choice> -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json --no-header --print-json | tail -n 1 | jq '.' > ./tmp.json && jq -s '.[0] * .[1]' ./user_data/mgm-config-hyperopt.json ./tmp.json > ./tmp2.json && rm ./tmp.json ./user_data/mgm-config-hyperopt.json && mv ./tmp2.json ./user_data/mgm-config-hyperopt.json && jq '.' ./user_data/mgm-config-hyperopt.json

Reset HyperOpt Results:

rm ./user_data/mgm-config-hyperopt.json

Back Testing MoniGoManiHyperStrategy.py:

freqtrade backtesting -s MoniGoManiHyperStrategy -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json --timerange 20210101-20210316 --enable-protections

Total Average Signal Importance Calculation (with the Total-Overall-Signal-Importance-Calculator.py):

python ./user_data/mgm_tools/Total-Overall-Signal-Importance-Calculator.py

Retrieve and apply a current Binance-Top-Volume-StaticPairList.json file (using Binance-Retrieve-Top-Volume-StaticPairList.json):

freqtrade test-pairlist -c ./user_data/mgm_tools/Binance-Retrieve-Top-Volume-StaticPairList.json --quote USDT --print-json | tail -n 1 | jq '.|{exchange: { pair_whitelist: .}}' > ./user_data/mgm_pair_lists/Binance-USDT-Top-Volume-StaticPairList.json && jq 'del(.exchange.pair_whitelist )' ./user_data/mgm-config.json > ./tmp.json && jq -s '.[0] * .[1]' ./tmp.json ./user_data/mgm_pair_lists/Binance-USDT-Top-Volume-StaticPairList.json > ./user_data/mgm-config.json && rm ./tmp.json && jq '.' ./user_data/mgm-config.json

Download Candle Data:

freqtrade download-data --timerange 20201201-20210316 -t 5m 1h -c ./user_data/mgm-config.json -c ./user_data/mgm-config-private.json

How to share your test results properly

The easiest way to share how your MGM setup has been doing would be by posting a screenshot in the Discord Server with the output of the /status table and /profit commands (Using the Telegram connection of the bot) + The complete output of the log being printed while HyperOpting (See Some Test Results for examples).

Also, one of the other most welcome things is the results from the Total-Overall-Signal-Importance-Calculator, but you'll have to paste your own fresh HyperOpt results in it first before it can make you a nice report that can help us find better signals for MGM !:rocket:

Of course all FreqUI / Telegram / config / HyperOpt results done on MGM can be useful / be learned from! Try to always include a Total-Overall-Signal-Importance-Calculator report or just your own MoniGoMani file with your HyperOpt results applied to it!
Since without knowing which signal weights or which on/off settings are applied we can't really truly learn much from your results!

The epoch table being generated when HyperOpting + the number of the epoch you used is also very helpful, so we can easily rule out if your test results are exploited. (See BackTesting-Traps!)

Common mistakes

TypeError: integer argument expected, got float

You likely are using a Float value where you should be using a Integer value. Hopefully your error will show more information about which Parameter.

  • Integer = Whole number. Examples: 1, 3, 23
  • Float = Decimal number. Examples: 1.53, 4.2, 17.12

-bash: jq: command not found

You still need to install jq

ValueError: the lower bound X has to be less than the upper bound Y

You probably ran with precision different from 1. If so then you need to run your 1st HO Run results through the calculator with -pu or --precision-used and then fix up your mgm-config-hyperopt.json with the adjusted results before firing up the 2nd HO Run.

Check out the documentation for the Precision Setting and the Total Overall Signal Importance Calculator!