whittlem / pycryptobot

Python Crypto Bot (PyCryptoBot)
Apache License 2.0
1.97k stars 739 forks source link

Preventloss does not work with declining market #801

Closed krzysztofMajchrzak-GIT closed 1 year ago

krzysztofMajchrzak-GIT commented 1 year ago

Hi, i think i have spotted the problem. You see when there is preventloss and preventlosstrigger set it seems not to work if margin does not cross the trigger. What i mean is that: This is my config:


{
    "binance": {
        "config": {
            "exchange": "binance",
            "api_url": "https://api.binance.com",
            "market": "ETHUSDT",
            "buypercent": 100,
            "sellpercent": 100,
            "sellatloss": 1,
            "preventloss": 1,
            "preventlosstrigger": 1.5,
            "preventlossmargin": 0.6,
            "nobuynearhighpcnt": 1
        },
        "api_key_file": "binance.key"
    }
}

So it should trigger a sell when margin reaches 0.6 and the watching should start on 1.5. BUT! if bot buys and the margin is negative on the next step the watching procedure never starts so it does not sell at all. Let me give you an example:

obraz

After buy the very next margin is already -4%. This means that the trigger never triggers cause there was no positive 1.5 margin. This way it will hold the position until it reaches 1.5 and declines above 0.6 or there is a selling signal in between.

whittlem commented 1 year ago

Closing this as the change was been implemented by a contributor PR.