Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

First independent community of traders

First independent community of traders Logo First independent community of traders Logo

First independent community of traders Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Buy Theme
  • Home
  • About Us
  • Blog
  • Contact Us
Home/ Questions/Q 4282
Next
In Process
trader_patinhas
trader_patinhas

trader_patinhas

  • 1 Question
  • 1 Answer
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
trader_patinhas
Asked: December 27, 20202020-12-27T05:06:09+00:00 2020-12-27T05:06:09+00:00In: Forex Expert Advisors

OrderSendAsync () – is it guaranteed that commands are processed in the same order as they are sent?

  • 0

Dear friends,
Let’s say I have a listing order waiting to sell a certain instrument on the stock market.
If I run the OrderSendAsync () command to cancel this order, and shortly after that I run another OrderSendAsync () command to send a buy order to the market for the same instrument, is it guaranteed that my sell limit will be canceled before my market is bought the order is executed?
Is there a chance that the OrderSendAsync () commands are executed out of order, and my limit on putting up for sale is canceled by my purchase order in the market before it is canceled?
What if I use OrderSend () instead of OrderSendAsync ()?
ps: of course, I could just poll the pending sale status and wait for the cancellation to be confirmed before sending the sales order to the market, but due to performance requirements, I need the evacuation time between canceling the sales order and sending the purchase order as short as possible so that OrderSendAsync () would be preferable to OrderSend () if the desired sequence of events could be guaranteed.



  • 3 3 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    3 Answers

    • Voted
    • Oldest
    • Recent
    1. trader_patinhas

      trader_patinhas

      • 1 Question
      • 1 Answer
      • 0 Best Answers
      • 20 Points
      View Profile
      trader_patinhas
      2020-12-27T05:06:23+00:00Added an answer on December 27, 2020 at 5:06 am

      @ Andrew Khotimliansky , @ Vasily Sokolov

      Thank you so much for your answers!

      Waiting for the TradeTransaction event confirming the cancellation of the previous order will be bad news for me, because I need the time interval between canceling the first order and sending the second one to be as short as possible.

      I hope the problem can be solved by simply changing OrderSendAsync () to OrderSend (), but that seems like an illusion.

      From what I understand from your answers (I can’t speak Russian and rely on automatic translation for reading and writing), it seems that TCP / IP networks (the Internet in General) they cannot guarantee that data packets arrive in the same order as they are sent. So the commands to cancel the previous order and to send a new order can be received out of order on the server, right?

      Life is very hard!

      Thank you guys!

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. c-4

      c-4

      • 0 Questions
      • 8 Answers
      • 0 Best Answers
      • 36 Points
      View Profile
      c-4
      2020-12-27T05:06:18+00:00Added an answer on December 27, 2020 at 5:06 am

      Trader_Patinhas:
      …If I run the OrderSendAsync () command to cancel this order, and shortly after that I run another OrderSendAsync () command to send a buy order to the market for the same instrument, is it guaranteed that my sell limit will be canceled before my market is bought the order is executed?



      There is no such guarantee. Note, however, that in Your case, a pending order can be canceled both BEFORE entering the market and AFTER it. The main thing is that the pending order does not work during the placement of the second order.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    3. komposter

      komposter

      • 1 Question
      • 36 Answers
      • 0 Best Answers
      • 92 Points
      View Profile
      komposter
      2020-12-27T05:06:13+00:00Added an answer on December 27, 2020 at 5:06 am

      Good question.

      There are no guarantees.
      At least because the first OrderSendAsync may get lost on the way to the server, and the second will reach earlier.

      If you need to delete an order and then enter the market, use OrderSend or OrderSendAsync with the result analysis in OnTradeTransaction.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Stats

    • Questions 504
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 681
    • Popular
    • Comments
    • Tags
    • forexcommunity

      Highlighting what’s important about questions & Answers on Discy Community!

      • 0 Comments
    • forexcommunity

      Introducing Keyboard Shortcuts, our first Labs feature

      • 0 Comments
    • forexcommunity

      Defining quality on Discy Engine — what a helpful answer ...

      • 0 Comments
    • forexcommunity

      Organizational and company accounts on Discy Engine the next step

      • 0 Comments
    • forexcommunity

      Hello world!

      • 0 Comments

    Related Questions

    • Brus Agell

      Правельный выбор

      • 0 Answers
    • pinupcasinoo

      Pin Up Casino

      • 0 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 2 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 0 Answers
    • c00l777

      Optimization results differ on different accounts

      • 3 Answers

    Users

    Leonardcig

    Leonardcig

    • 0 Questions
    • 0 Answers
    DennisByday

    DennisByday

    • 0 Questions
    • 0 Answers
    Haroldmeary

    Haroldmeary

    • 0 Questions
    • 0 Answers

    Footer

    First independent community of traders

    About

    An independent community of forex traders. This is where traders communicate. You can ask your questions and you will receive an answer to your question.
    • Terms of Use
    • Privacy Policy
    • Cookie Policy
    • Knowledge Base
    • Support

    © 2021 Forexcommunity.net. All Rights Reserved