hellow,
Probably this is a newbie question but here we go.
I regardless the discussion whether this is a good idea or not, what I want to do is the following as below :
Instead of a stoploss, once my long or short order is triggered I want to set a sellstop (in case the long order is triggered) or a buystop (in case of a short order is triggered).
So the first situation is that in the beginning of the EA I set a buystop and a sellstop (first part of the image), once either the buystop or sellstop is triggered I want to put a 'counterorder' on a certain defined distance, instead of a stoploss let's say.
using this principle, i need to know which order has been triggered, in order to call the proper function (putting either the sellstop or buystop), but I don't know how to do that.
The final EA is a lot more complex than this, but this is the principle (knowing which order is triggered and based on that call a function).
Could somebody please be so kind to help me out plz?
thanks a lot.
Have a look at this:
https://www.mql5.com/en/docs/event_handlers/ontradetransaction
- www.mql5.com
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hellow,
Probably this is a newbie question but here we go.
I regardless the discussion whether this is a good idea or not, what I want to do is the following as below :
Instead of a stoploss, once my long or short order is triggered I want to set a sellstop (in case the long order is triggered) or a buystop (in case of a short order is triggered).
So the first situation is that in the beginning of the EA I set a buystop and a sellstop (first part of the image), once either the buystop or sellstop is triggered I want to put a 'counterorder' on a certain defined distance, instead of a stoploss let's say.
using this principle, i need to know which order has been triggered, in order to call the proper function (putting either the sellstop or buystop), but I don't know how to do that.
The final EA is a lot more complex than this, but this is the principle (knowing which order is triggered and based on that call a function).
Could somebody please be so kind to help me out plz?
thanks a lot.