Hallo Steve, peeps,
Me again
MPTM is by far the best trade manager ever! I've been delving into it alot of late (hence the posts)
This time around: part-close functionality under scrutiny.
I've observed the default behaviour thus:
MPTM:
JumpingStop=1
JumpingStopPips=40
PartCloseEnabled=1
Close_LotsFract=0.25
My trade order size: 0.04 lots (example)
At MPTM init:
--> Close_Lots = 0.01
--> Preserve_Lots = 0.03 =====> this remains the same for the duration of the trade (?)
When price gets to +40pips profit ---> SL moved to BE, 0.01 closed at 40pips ==> OK
After that, trade carries on with Preserve_Lots lot size.
==
What I'd like to happen:
+40pips ---> SL at BE, 0.01 closed
+80pips ---> SL at +40pips, 0.01 closed
+120pips ---> SL at +80pips, 0.01 closed
+160pips ---> SL at +120pips, 0.01 closed
I.E: would like 0.01 to be closed at each subsequent jump, not only at first jump.
I'm still learning to code in mql, so i'm far from expert level; would the below snippet allow my desired behaviour?
## In PartCloseTradeFunction()
Code: Select all
bool result=OrderClose(OrderTicket(), Close_Lots, price, 5, CLR_NONE);
if (result)
{
if (ShowAlerts==true) Alert("Partial close of ", OrderSymbol(), " ticket no ", OrderTicket());
Preserve_Lots = Preserve_Lots - Close_Lots; ////// ADDITION
return(true);
}
NB: The jumping stop part is working flawlessly as always; no issue with that.
Cheers