krishna_gopal_2:
You have to read the documentation about OnTradeTransaction.
Using above code I'm placing only one order and I expected only two times (one for placing order and another for TP) the OnTrade() function will be executed. But its been executed for 5 times.
Can anyone tell me why it happens?
...
Can you please answer my question in How to Get Order details from Deal ?
The answer is the same as above, you have to use OnTradeTransaction. Search the forum with this keyword for example. If you have difficulties to use it, show your code to receive help.

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
Using above code I'm placing only one order and I expected only two times (one for placing order and another for TP) the OnTrade() function will be executed. But its been executed for 5 times.
Can anyone tell me why it happens?
Output from tester:
2013.07.09 21:19:43 2013.01.14 00:56:40 One Time
2013.07.09 21:19:43 2013.01.14 00:56:40 One Time
2013.07.09 21:19:43 2013.01.14 00:56:40 order performed sell 1.00 at 1.33680 [#3 sell 1.00 EURUSD at 1.33680]
2013.07.09 21:19:43 2013.01.14 00:56:40 deal performed [#3 sell 1.00 EURUSD at 1.33680]
2013.07.09 21:19:43 2013.01.14 00:56:40 deal #3 sell 1.00 EURUSD at 1.33680 done (based on order #3)
2013.07.09 21:19:43 2013.01.14 00:56:40 take profit triggered buy 1.00 EURUSD 1.32683 tp: 1.33680 [#3 sell 1.00 EURUSD at 1.33680]
2013.07.09 21:19:42 2013.01.02 04:07:00 One Time
2013.07.09 21:19:42 2013.01.02 04:07:00 One Time
2013.07.09 21:19:42 2013.01.02 04:07:00 One Time
2013.07.09 21:19:42 2013.01.02 04:07:00 OrderSent