Skip to content

take profit and stop loss behavior #242

Answered by kernc
nkami asked this question in Q&A
Discussion options

You must be logged in to vote

If you enter with a plain market order, SL has priority (the framework takes an adversarial, rather than an optimistic stance).

If you enter with a stop/limit order, a warning is emitted:

elif (low <= (order.sl or -np.inf) <= high or
low <= (order.tp or -np.inf) <= high):
warnings.warn(
f"({data.index[-1]}) A contingent SL/TP order would execute in the "
"same bar its parent stop/limit order was turned into a trade. "
"Since we can't assert the precise intra-candle "
"price movement, the affected SL/TP order will instead be executed on "
"the next (matching) price/bar, maki…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nkami
Comment options

Answer selected by nkami
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants