How to increase position size relative to current size? #545
Unanswered
mtomic-quant
asked this question in
Q&A
Replies: 2 comments
-
You need to implement a custom order function where you can set order size dynamically based on the current position size. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am looking to double down on position size each time a signal occurs. In other words, if I am not in any position and a signal occurs, then I would always enter a new position with a fixed size of lets say 1. However if the same direction signal occurs again while I am already in the position, then I want to double the size of the current position size and iterate like that if more subsequent signals occur.
As an example: if my position now is size=1, and then 3 short signals occur, then my positions should be 2, then 4, then 8 etc.
My code above specifies both short and long entries, and if I am currently short and a long signal arrives then I exit the position, and vice versa. However if same direction signal arrives then I should keep doubling down on the position until opposite (exit) signal arrives. Here I specified size=1 and size_type="amount" which will enter positions with size=1 as I want, however this will keep adding only one size to position rather than doubling it.
Instead of increasing my position in a sequence
1, 2, 3, 4, 5, etc
as same direction signals arrive, I want to increase the position in a sequence1, 2, 4, 8, 16, etc
.Thanks
Beta Was this translation helpful? Give feedback.
All reactions