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 6245
Next
In Process
aziriz
aziriz

aziriz

  • 1 Question
  • 3 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
aziriz
Asked: January 27, 20212021-01-27T07:12:37+00:00 2021-01-27T07:12:37+00:00In: Forex Expert Advisors

Help!! function for deleting pending orders

  • 0

Dear mql4 gurus. Please help me write a function for removing postponements, after a given number of seconds, how to implement it over time, I can not understand… it is not necessary to write the entire function, I can not make the very condition that if for example 10 seconds have passed since the installation of the delay, then it must be removed. That’s something like that.

  • 7 7 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    7 Answers

    • Voted
    • Oldest
    • Recent
    1. knelson

      knelson

      • 0 Questions
      • 1 Answer
      • 0 Best Answers
      • 22 Points
      View Profile
      knelson
      2021-01-27T07:13:36+00:00Added an answer on January 27, 2021 at 7:13 am

      Hello, tell me, there is such a function that it would be possible to transfer a pending order for a certain number of pips, not to trawl the order and transfer it once to the distance that is set in the settings. Sincerely, Alexander.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. aziriz

      aziriz

      • 1 Question
      • 3 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      aziriz
      2021-01-27T07:13:29+00:00Added an answer on January 27, 2021 at 7:13 am

      Vladimir Zubov:

      variable >=> current time

      otherwise, the moment of true equality may slip by, for a number of reasons)

      exactly)) thank you very much to everyone)

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

      vitales

      • 1 Question
      • 25 Answers
      • 0 Best Answers
      • 72 Points
      View Profile
      vitales
      2021-01-27T07:13:23+00:00Added an answer on January 27, 2021 at 7:13 am

      Ruslan Udintsev:

      SOLVED IT THIS WAY

      variable = opening time + time how long the order should exist in seconds

      variable = current time

      if these two variables are equal then we delete the order 

      You can do that. You just work with the same type of datetime variables. In my version, variables of different types are datetime and int.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    4. aziriz

      aziriz

      • 1 Question
      • 3 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      aziriz
      2021-01-27T07:13:12+00:00Added an answer on January 27, 2021 at 7:13 am

      Vitalii Ananev:

      This piece just calculates the difference between the current time and the order opening price, and this difference will be in seconds, since datetime variables store date and time data in the form of the number of seconds that have passed since 1.01.1970.

       If it is necessary in minutes, then multiply the TimeLimit by 60 if in hours, then by 3600 (the number of seconds in one hour) 

      If the difference between TimeCurrent()-OrderOpenTime () is less than TimeLimit, then the time has not expired yet, if it is more, then the rest of the code is executed, where the order type is checked and deleted. 

      To avoid bothering with type casting change the type of the TimeLimit variable from uint to int and then this piece will look like this:

       

      that’s exactly what I did, but why do I have a difference?. the time and time of opening turns out to be like this 1970.01.01 00:00:51

      as I understand it, you should get a number in seconds, for example, 5 seconds or 10. But it turns out this date  

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    5. vitales

      vitales

      • 1 Question
      • 25 Answers
      • 0 Best Answers
      • 72 Points
      View Profile
      vitales
      2021-01-27T07:13:05+00:00Added an answer on January 27, 2021 at 7:13 am

      Ruslan Udintsev:

      it does not work for me, in the second function, the condition for checking the difference between the opening time and the current time, if some calculations occur with this data, the date is reset to 1970

      I don’t understand why you can’t just take and subtract the opening time from the current time and whatever value you get there.

      how do I do this? if using the example of the second function to get the difference in seconds would be very great 

      if ((uint)(TimeCurrent()-OrderOpenTime())

      This piece just calculates the difference between the current time and the order opening price, and this difference will be in seconds, since datetime variables store date and time data in the form of the number of seconds that have passed since 1.01.1970.

       If it is necessary in minutes, then multiply the TimeLimit by 60 if in hours, then by 3600 (the number of seconds in one hour) 

      If the difference between TimeCurrent()-OrderOpenTime () is less than TimeLimit, then the time has not expired yet, if it is more, then the rest of the code is executed, where the order type is checked and deleted. 

      To avoid bothering with type casting change the type of the TimeLimit variable from uint to int and then this piece will look like this:

       

      if ((TimeCurrent()-OrderOpenTime())

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    6. aziriz

      aziriz

      • 1 Question
      • 3 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      aziriz
      2021-01-27T07:12:48+00:00Added an answer on January 27, 2021 at 7:12 am

      it does not work for me, in the second function, the condition for checking the difference between the opening time and the current time, if some calculations occur with this data, the date is reset to 1970

      I don’t understand why you can’t just take and subtract the opening time from the current time and whatever value you get there.

      how do I do this? if using the example of the second function to get the difference in seconds would be very great 

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    7. vitales

      vitales

      • 1 Question
      • 25 Answers
      • 0 Best Answers
      • 72 Points
      View Profile
      vitales
      2021-01-27T07:12:42+00:00Added an answer on January 27, 2021 at 7:12 am

      Ruslan Udintsev:
      Dear mql4 gurus. Please help me write a function for removing postponements, after a given number of seconds, how to implement it over time, I can not understand… it is not necessary to write the entire function, I can not make the very condition that if for example 10 seconds have passed since the installation of the delay, then it must be removed. That’s something like that. 

      void DeleteAllOrder(int Cmd, uint TimeLimit)
      {
        
         int count=OrdersTotal();
         if (count<=0) return;
         for (int i=Count;i>=1;i--)
         {
            if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
            {
                if ((uint)(TimeCurrent()-OrderOpenTime())continue;
                if (Cmd==-1)
                {
                  if (OrderType()==OP_BUYLIMIT || OrderType()==OP_BUYSTOP ||
                       OrderType()==OP_SELLLIMIT || OrderType()==OP_SELLSTOP)
                           OrderDelete(OrderTicket());
                }else
                if (OrderType()==Cmd) OrderDelete(OrderTicket());
            }    
         }
      }
      / / Cmd-order type, if -1, then all pending orders.
      //TimeLimit life time of the order. for example, if you need to set the lifetime to 1 hour, the TimeLimit should be 1*3600
      Try this feature.

      • 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 530
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 754
    • 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

    • BrantHaps

      write my essay ndl

      • 0 Answers
    • Galengask

      write my paper qxg

      • 0 Answers
    • Johnbup

      Слоты в онлайн казино. Игровые автоматы бесплатно

      • 0 Answers
    • StephenWaibe

      Торгуйте акциями основных технологических компаний США

      • 0 Answers
    • Doublebtc-Ceact

      DoubleBTC.WIN - Double your bitcoin in 24 hours

      • 0 Answers

    Users

    JeffreyPew

    JeffreyPew

    • 0 Questions
    • 0 Answers
    Jamesdah

    Jamesdah

    • 0 Questions
    • 0 Answers
    Michaelnaw

    Michaelnaw

    • 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