Close portion of trade and leave remainder to run #992
CadeHalcyon
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, I have a simple problem, which is driving me crazy. I've simplified a scenario below... I want to:
self.buy(tp=price*1.10....)
The problem:
The trade will continue to reduce by 50% again and again after price moves 5% above entry price. Trade size will go from 1000 to 500 to 250 to 125 etc...
Question:
How do I only close out a portion of the trade once, please? In my mind, I want to somehow reference the size of the trade when it was first opened to create a condition for closing 50%, but
trade.size
inself.trades
andposition.size
inself.position
both get overwritten each time a portion of the trade is closed.Grateful for any help! Simplified code below:
Beta Was this translation helpful? Give feedback.
All reactions