QuantConnect / Lean.Brokerages.InteractiveBrokers

InteractiveBrokers Brokerage Plugin
Apache License 2.0
27 stars 17 forks source link

Trailing stop orders #70

Closed jhonabreul closed 11 months ago

jhonabreul commented 11 months ago

Description

This adds support for trailing stop orders, implemented in https://github.com/QuantConnect/Lean/pull/7402.

The following chart shows the stop price update for a live deployment where a buy order for SPY was placed during a time where SPY prices where slowly decreasing. The initial stop price was $458 with a trailing amount of $0.4. As shown in the chart, the stop price was updated to follow the lowest low price as it decreased.

chart (10)

On the other hand, for a sell order with an initial stop price of $457.7 and a trailing amount of $0.4:

chart (11)

Related Issue

Motivation and Context

Supporting more order types.

Requires Documentation Change

How Has This Been Tested?

Types of changes

Checklist: