trim opposite lot size
-
hi,
i have a hedging strategy, were, for example, buy position is open, and a sell position is open 10 pips below the buy position, with same lot size, if buy tp is hit, i want to "trim" the sell position lot size down half. how do i do that... -
on trade tab, purple position closed - pink for each trade - close (partially)
-
Hey. To adjust the lot size of the sell position when the buy take profit is hit, you can use the PositionGetDouble(POSITION_VOLUME) function to get the current volume of the sell position, then calculate half of it and use PositionSetDouble(POSITION_VOLUME) to update the volume accordingly. Hope I helped!
-
what if i had more than one sell position open. and i want one of them "trimming down"(lot size), how do i pick the one i want to trim... the furthest one away, for example...
-
@JamieCisneros
im on mql4, but thanks anyway... -
@nahimh That is far more complicated. How many open trades should be considered? Will the criteria to trim a trade change (now the second one, then the fourth one, etc)? If so you will need a custom code array to get that.
-
@l-andorrà thanks for replying,
the criteria to trim is the furthest opposite trade gets trimmed first, until its completely closed, then then 2nd furthest, 3rd furthest, etc...
but it will complicated to pull it off on fxdreema..
-
Then definitely you will need some custom code to find that 'furthest' trade each time a new one is identified. I'm afraid there is no simple fxDreema structure doing that.