Let me make my question very simple.
If I have an order with SL. My EA does checks if there is an order or not. If there is an order, I print out the order information, for example. If there is no order, my EA doesn't do anything.
If new price hits the SL value of the order, what happens?
If the system SLs the order first, my EA doesn't do anything because there is no order.
But if my EA is executed first, my EA will print the information of the order because still there is an order, because it is not SLed yet by the system.
So what is the sequence of execution in this case?
Question: Which happens first? Answer: Both.
The order is closed on the broker's server. A tick is sent to your machine.
In my modify stops routine, in the for/select loop, I was able to see the order being a fraction of a pip below the stop, but when I tried to force it closed, I get invalid ticket. I changed the test for Bid <= SL - pip and the message was suppressed.
Most of the time the EA won't see the order as open, sometimes it will.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am writing a small EA, using sellstop and/or buystop with SL.
So when the current price, for example, drops below the sellstop order, the order will change to sell automatically by the system, not by my EA.
Also, if the price goes higher than the SL of the sell order, it will SL and the order will be gone, again by the system.
If I understand correctly, the start function of the EA will be executed on every new tick.
My question is:
When a new tick comes and if the newly come price is, for example, higher than the SL of the sell order, which one performs its task first? Will it be SLed first and my start function will be executed? Or my start function will be executed first and then the order will be SLed?
Same question with changing from sellstop to sell order!
Does anyone have an idea?