Check out the algorithm:
Forum on trading, automated trading systems and testing trading strategies
Vladimir Karputov, 2020.10.22 20:31
We catch the transaction
Code: We catch the transaction.mq5
This is a blank - an example of how to control a trading signal. This code avoids the situation: opening multiple positions. How it works: after a trade order is generated, we increase the 'SPosition' structure. In OnTick, if 'SPosition' is greater than zero, go to the block for opening positions. In OnTradeTransaction, we monitor the situation when a position appears exactly on our signal.
Example:
2021.01.08 15:28:08.316 We catch the transaction (USDJPY,M30) We catch the transaction.mq5 SearchTradingSignals, OK: Signal BUY 2021.01.08 15:28:08.529 We catch the transaction (USDJPY,M30) We catch the transaction.mq5 PrintResultTrade, Symbol: USDJPY, Code of request result: 10009, Code of request result as a string: done at 103.907Trade execution mode: Trading on live streaming prices 2021.01.08 15:28:08.529 We catch the transaction (USDJPY,M30) Deal ticket: 804407087, Order ticket: 823201677, Order retcode external: 0, Volume of deal or order: 1.00 2021.01.08 15:28:08.529 We catch the transaction (USDJPY,M30) Price, confirmed by broker: 103.907, Current bid price: 103.907 (the requote): 103.907, Current ask price: 103.907 (the requote): 103.907
Tab 'Trade':
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
Hey Guys,
I want to get the ticketnr. after I opened a position to be able to work with it (close it) later.
however, I get a ticket nr. thats a litte lower that what the actual nr. is.
Any Ideas?
Regards
Lucas