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 4404
Next
In Process
hoz
hoz

hoz

  • 16 Questions
  • 22 Answers
  • 0 Best Answers
  • 32 Points
View Profile
  • 0
hoz
Asked: December 27, 20202020-12-27T05:12:32+00:00 2020-12-27T05:12:32+00:00In: Forex Expert Advisors

Why do I need the IsStopped () function ?

  • 0

I see that it is most often used in cycles in the latest indicators. Shoveling the branches that were raised on this occasion. Someone writes that this function is not needed at all. Someone writes the type needed. As for me, there is no reason to check whether the program is closed, because if it is closed, then it will close and why check it?

Because for me, as I see now, this function has no use, but still I use it, the question arose why do they use it at all?

My thoughts are:

For example, there is a function that opens orders in the standard library. At the beginning, IsStopped () is checked. What for? After all, if, for example, when the program is running and the queue has reached the point where this check takes place, the check:

bool CTrade::OrderOpen(const string symbol,const ENUM_ORDER_TYPE order_type,const double volume,const double limit_price,
                       const double price,const double sl,const double tp,
                       ENUM_ORDER_TYPE_TIME type_time,const datetime expiration,const string comment)
  {
//--- check stopped
   if(IsStopped(__FUNCTION__))
      return(false);

the program execution will end and the order will not be sent. Then why do we need this 2 (3) extra lines of code? After all, whatever you say, the program will not continue to run because it is already closing.. (if it closes).

  • 2 2 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. rickd2

      rickd2

      • 0 Questions
      • 1 Answer
      • 0 Best Answers
      • 22 Points
      View Profile
      rickd2
      2020-12-27T05:12:42+00:00Added an answer on December 27, 2020 at 5:12 am

      It is probably a common approach to add a check for IsStopped at the beginning of most CTrade functions. Some functions may internally expect something in a loop, so in order not to bother and keep the behavior of each function in memory, it is easier to add IsStopped everywhere.

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

      scriptong

      • 2 Questions
      • 37 Answers
      • 0 Best Answers
      • 94 Points
      View Profile
      scriptong
      2020-12-27T05:12:35+00:00Added an answer on December 27, 2020 at 5:12 am

      hoz:

      I see that it is most often used in cycles in the latest indicators. Shoveling the branches that were raised on this occasion. Someone writes that this function is not needed at all. Someone writes the type needed. As for me, there is no reason to check whether the program is closed, because if it is closed, then it will close and why check it?

      Because for me, as I see now, this function has no use, but still I use it, the question arose why do they use it at all?

      My thoughts are:

      For example, there is a function that opens orders in the standard library. At the beginning, IsStopped () is checked. What for? After all, if, for example, when the program is running and the queue has reached the point where this check takes place, the check:

      the program execution will end and the order will not be sent. Then why do we need this 2 (3) extra lines of code? After all, whatever you say, the program will not continue to run because it is already closing.. (if it closes).

      Without IsStopped (), the program, if it performs some complex calculations, will crash, which is not very good. This is especially true for programs that display data using graphical objects. An emergency shutdown will leave all readings of such a program intact. First, it’s garbage on the chart. Secondly, the user gets the impression that the program is frozen, and not disabled.

      Before opening an order, IsStopped() is checked for the same reason. If the user decides to remove the program from the chart, then it is not necessary to perform a trading operation, which takes quite a long time. As a result, the risk of an emergency program termination increases.

      For indicators, due to their use of cycles, this is generally an indispensable thing. After all, the execution of an infinite loop in the indicator suspends the chart (MT5)or the entire terminal (MT4).

      • 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 674
    • 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

    RobertFoeta

    RobertFoeta

    • 0 Questions
    • 0 Answers
    Brus Agell

    Brus Agell

    • 1 Question
    • 0 Answers
    pinupcasinoo

    pinupcasinoo

    • 1 Question
    • 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