You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How do I know in OnTradeTransaction () that SL/TP has been triggered?
Use TRADE_TRANSACTION_DEAL_ADD
Use TRADE_TRANSACTION_DEAL_ADD
Please expand the answer.
How do I know from this that the position has closed on SL/TP?
Please expand the answer.
How do I know from this that the position has closed on SL/TP?
You have an open position.
If you are making any transactions with the position yourself, then you will have order tickers,
which you are operating on. But ifTRADE_TRANSACTION_DEAL_ADD is sent, but none of your
order is not shown in the message, then it means that you have triggered SL/TP
if (trans.order != my_order_ticket)
{
//Сработал SL или TP
}
break;
Added
If you use more than 1 EA,
then you need to do additional checks
on the magician and symbol
Added
But better not to use SL and TP at all, i.e. they are not output in trading
I use SL and TP in my system, and they are not output in the trading system, but stored on the server. I, for example, use SL and TP
pending orders. To be fair, it should be noted that
working with pending orders is much more time consuming
but more secure, because the orders are already in the trading system and
It is easy to track them by ticket.
You have an open position.
If you are making any operations on the position yourself, then you will have order tickers,
which you operate on. But ifTRADE_TRANSACTION_DEAL_ADD is sent, but none of your orders
order is not shown in the message, then it means that the SL/TP
if (trans.order != my_order_ticket)
{
//Сработал SL или TP
}
break;
Added
If you use more than 1 EA,
then you need to do additional checks
on the magician and symbol
Added
But better not to use SL and TP at all, i.e. they are not output in trading
I use SL and TP in my system, and they are not output in the trading system, but stored on the server. I, for example, use SL and TP
pending orders. To be fair, it should be noted that
working with pending orders is much more time consuming
but more secure, because the orders are already in the trading system and
It is easy to track them by ticket.
Thanks, seems to understand now how to detect that SL/TP has triggered (but I must say it's still a rectal method, there should be an easier way).
And what about limit orders instead of SL/TP, isn't it fraught with danger if we're talking about withdrawing positions to LP? Limits will be visible in the stack and therefore easier to "eat". Although then it turns out that TP is more profitable to put as a limit order?
Thanks, it seems to be clear now how to determine that SL/TP is triggered (but I must say it's still a rectal method, there must be an easier way).
And what about limit orders instead of SL/TP, isn't it fraught with danger if we're talking about withdrawing positions to LP? Limits will be visible in the stack and therefore easier to "eat". Although then it turns out that TP is more profitable to put as limiters?
---> there should be an easier way)
There should be, but there isn't, yet.
-->and therefore easier to "eat".
Then why are you setting SL/TP at all ?
Setting pending orders as SL/TP, you are 100% sure to be protected from slippage
and failure to trigger.
By setting pending orders as SL/TP you are 100% sure to be protected from slippage
and not working.
It's as if both of you have never really traded....
--->Limit can be redirected. SL is identical to a stop loss order.
You will be notified of this "accident", whereas any other orders (stored on the server) are not predictable at all.
--->If the SL or TP slips, ....
Everything can be found out, it pays to think a bit and read carefully what is being written to you.
Added
All my statements apply ONLY to stock trading.
It's as if both of you have never really traded....
--->Limit can be redirected. SL is identical to a stop loss order.
You will be notified of this "accident", whereas any other orders (stored on the server) are not predictable at all.
--->If the SL or TP slips, ....
Everything can be found out, it's worth a little thought and to read carefully what is written to you.
I've never handled OnTradeTransaction () event before, it wasn't necessary because there was no need to consider what triggered it in trading logic. SL or TP. Do you think it shows my trading experience?)))
Everything can be found out, it's worth a little thought and careful reading of what is written to you.
I read very carefully, but I don't see anyone giving a sensible answer in the form of a working code. Or is it a fucking secret and great sorcery - secret knowledge and the ability to determine what worked?