Need some advice regarding this
-
Hello need some advice on this:
I am trying to calculate lot size based on previous trade's unrealized loss along with the new trade's take profit.
Let say trade A is running in 20 pips loss, so open a trade B with predetermined take profit of "10 pips" and when the trade B hit the take profit ea should close trade A as well so the trade A loss will be 30 pips and the trade B profit will be 10 pips but the lot size of the trade B needs to be calculated in such a way that it should recover the loss of trade A and even out the 30 pip loss in 10 pips (to do this the lot size of trade B definetly needs to be more than the lot size of trade A.)
Any ideas? -
@zackry
In English:
lot B is bigger when loss A or lot A is bigger, and smaller when tp B is
bigger.In math:
lot B = (loss A * lot A) / tp BIn computer:
https://fxdreema.com/shared/pCTJzt5D


Hope my math checks out lol
-
@roar thanks bro I will test it with the rest of the ea and will update here,
-
@roar what would be the mq4 alternate for this:lotsize = (PositionGetDouble(POSITION_VOLUME)
-
@zackry Oh, yes thats mql5 there.
OrderLots() should work for mql4:
https://docs.mql4.com/trading/orderlots -
@roar in that case there wont be any need for POSITION_VOLUME right?
-
@zackry Thats right -
lotsize = (OrderLots()*losspips)/tpPips;