Hello Support,
I'm trying to finalize some order handling issues and I want your feedback on a design theory for managing open positions. I'll try to keep it simple. Let's take a very simple scenario, first.
- Assume that the EA opens a Buy Order with an attached Limit Order (Pending)
At this point, if the market moves to the Pending Limit Order level, the position will be closed by design. That's fine and I understand how that works. Here's what I need to know, however.
Given the above assumption, could I place a DeleteP on the Sell side of the Diagram and then connect it to an MQL block containing the conditions that would "delete" (remove) the "Pending Limit Order" that was put into play on the Buy side of the Diagram?
My thinking is that since the Pending Limit Order that was generated by the Buy side of the Diagram, is in fact a
Pending Sell Order, that it should be removable by the use of a DeleteP function on the Sell Side of the Diagram. (yes/no?)
Or, should I instead, place the DeleteP function on the Buy side of the Diagram, with the understanding that you must remove the pending order from the side in which it was created?
This will give me the ability to launch a trade with one expectation for profit, and then when certain conditions change AFTER the setting of the Limit Order, to then shift the authority to close that trade to the Buy side of the Diagram, using the CL function. Of course, the MQL block conditions that trigger the CL, are designed to come AFTER the MQL conditions that trigger the DeleteP. So, everything remains in proper sequence without circular logic.
So, in sequence:
If (conditions trigger DeleteP, then Pending Limit Order gets removed and control for closing the position gets passed to CL [so to speak - there is no real variable passing going on])
I'm just a bit unsure about which side I should anchor the DeleteP function. Buy side, or Sell side? An educated guess tells me the Sell side, but I need your confirmation on that guess.
Thanks!
cfx