Using fixed amount for partial close
-
Hi,
Currently I am using pips away from open price for partial close and it is working well. However, I also like to add an "OR" option if price hit a certain amount for partial close. I use the below and it doesnt work. Can anyone advise?
Project Link[https://fxdreema.com/shared/wEa2KUHS](link url)Current Setup;

-
Connect block 65 directly to block 49 (orange dot).
-
Hi @l-andorrà ,
I tried your recommended but it doesn't work. I tried to understand the logic.
Base on tutorial explanation - my diagram state that "For each trade" it will do block 48 (if condition not true) YELLOW DOT (OR clause) then do Block 65
OR Is it that blue block cannot flow to pink block?
-
Yes, the blue block can be connected to pink blocks. If you connect the blue block to the yellow output of block 48, it will not be checked until block 48 has been checked. Connecting it to block 49 makes sure it will be checked independently of block 48. Can you confirm there were cases in whick more than $100 was in profit AND price was not as many pips away as you specified AND the trade was not closed?
Because if this is true, then you should create a thread on the Bugs forum explaining the problem with the 'close partially' block. The admin always takes a look at it.
-
@l-andorrà Thanks. I will replicate the setup and post in the BUGS section.
-
@traderea6 I think this is working just fine. Technically. Its just that 1 ATR is very small distance, and 100 money is relatively big distance with 0.1 lots.
Note that "once per trade/order" will activate just once per trade, as it says, no matter of what happens above that block.
-
Here's a handy trick for troubleshooting: use visual tester and vertical lines. I draw light pink line for each "pips away" pass and blue line for each "money away" pass.

https://fxdreema.com/shared/OLfevPZB
I used 5 times ATR and 3 money for the inputs, so there's a chance for them both to activate.
Aaand as it turns out, the money condition is active most of the time, and pips away condition activates only when ATR is very low:

-
I will try this. Thanks
-
UPDATE @l-andorrà @roar - The reason whe trade doesnt get executed is because of the lot size. I am using 1% of balance base on SL and my lot size will be 0.57 or 0.29 etc. The type of sizing create error when the EA attempt to close 50% volume. I tested again with standard lot size such as 0.2 etc and it works.
Thank you
-
@traderea6 impressive detective work

This lot sizing bug has been reported already. You can fix with custom mql code.
To close 50% or nearest applicable part of a position, put this code in a "fixed" amount field:
MathFloor(PositionGetDouble(POSITION_VOLUME)*0.5 *100)/100
(this works for instruments that use 0.01 as minimum lot)
