Checking Whether The Pending Order Has Been Executed Or Not

 

I am using MQL5 in Borsa Istanbul. I trade in futures markets. In our exchange, just like in cryptocurrency exchanges, buyers and sellers place market maker orders, and this is how the market is formed. There is no spread like the FX markets, instead the buyer and seller meet at the best price and give a commission to the brokerage firm.

For example, the best buy order here is: 36,01 and the best sell order: 36,46

In this case, I place a buy order at the price of 36,05 now the best buy order here is: 36,05 and the best sell order: 36,46. If anyone sells it to me at 36.05, I can buy it. If anyone doesn't sell it to me, I can't buy it.

I trade futures contracts of AKBNK stock, the symbols for this stock's October and November futures are: F_AKBNK1023 and F_AKBNK1123.  If the price difference in the F_AKBNK1023 and F_AKBNK1123 contracts falls to 2% or less, I simultaneously open a sell transaction for the F_AKBNK1023 contract and a buy transaction for F_AKBNK1123. When the difference exceeds 4%, I do the opposite. Instead of buying the contract I want to make directly from the market, I want to buy it as a market maker. Based on the example above, if my pending buy order for the F_AKBNK1123 contract at a price of 36.05 is executed, I want to simultaneously sell the F_AKBNK1023 contract at the market price. 

How can I do that? Thank you for your help.

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
  • Usually people who can't code don't receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
  • Finally, you also have the option to hire a programmer in the Freelance section.