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

Fixed bug where the "stop loss" protection was not triggering #982

Merged
merged 1 commit into from
Dec 27, 2017

Conversation

acecilia
Copy link
Contributor

@acecilia acecilia commented Dec 24, 2017

I was simulating. My configuration specifies that:

c.sell_stop_pct = 1
c.buy_stop_pct = 1

While simulating I saw this:

captura de pantalla 2017-12-25 a las 2 26 05

This makes no sense, because the stop loss of 1% (c.sell_stop_pct = 1) should have triggered. This is a bug (I think).

I debugged it, and found that:

  • This happens when the buy order is triggered by a "buy stop" protection (c.buy_stop_pct = 1).
  • In such a case, when the "buy stop" protection triggers, s.acted_on_stop is set to true (line 178). As a consequence, s.sell_stop does not get assigned a value (line 601).
  • As a result, the stop loss (c.sell_stop_pct = 1) is disabled (in order for the stop loss to work, s.sell_stop must have a value (line 157)).

Happy holidays ;P

…as happening if the buy order was created due to a "buy stop" protection triggering.
Copy link
Owner

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for debugging this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants