Hi there, I'm having trouble with my partial close function , it seems to be not working as I get same results both if true or false. These are the lines:
Hope someone can help on this matter, thanks in advance.
Three errors:
- You send a non-existent lot as a volume (no check for a step, no check ...)
- You do not check the results of a trade (do not print return codes)
- You are not checking the account type: netting or hedge.
Three errors:
- You send a non-existent lot as a volume (no check for a step, no check ...)
- You do not check the results of a trade (do not print return codes)
- You are not checking the account type: netting or hedge.
Was my fault, it was:
(PositionGetDouble(POSITION_SL)<PositionGetDouble(POSITION_PRICE_OPEN))){
Also I had to NormalizeDouble, thank you anyway.
-
You can't just use OrderLots()/2 because that is not a multiple of LotStep, and you can't close or have remaining less than MinLot.
-
You also must check if you have already done it, to avoid repeated closing. Alternatives:
-
Move SL to Break Even+1 before the partial close. That way you know that you already did it.
-
Set a flag in persistent storage (files, global variables w/flush)
-
Open two orders initially, and close one (manually or by TP.)
-
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there, I'm having trouble with my partial close function, it seems to be not working as I get same results both if true or false. These are the lines:
Hope someone can help on this matter, thanks in advance.