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 2237
Next
In Process
vvebus
vvebus

vvebus

  • 3 Questions
  • 6 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
vvebus
Asked: December 26, 20202020-12-26T11:56:49+00:00 2020-12-26T11:56:49+00:00In: Forex Expert Advisors

OnDeinit Reason

  • 0

Who can tell you what the enum of deinitialization reasons is called?

In other words, to which enum do they refer:

Constant The value Description
REASON_PROGRAM 0 Expert
stopped working by calling the function

 ExpertRemove()

REASON_REMOVE 1 The program
removed from the chart
REASON_RECOMPILE 2 The program
recompiled
REASON_CHARTCHANGE 3 Symbol
or the schedule period has been changed
REASON_CHARTCLOSE 4 Chart
unopened
REASON_PARAMETERS 5 Input data
the parameters were changed by the user
REASON_ACCOUNT 6 Activated
another account or there was a reconnection to the trading server due to a change in the account settings
REASON_TEMPLATE 7 A
different chart template has been applied
REASON_INITFAILED 8 The OnInit() handler returned
non-zero value
REASON_CLOSE 9 Terminal
was closed
  • 11 11 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    11 Answers

    • Voted
    • Oldest
    • Recent
    1. vvebus

      vvebus

      • 3 Questions
      • 6 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      vvebus
      2020-12-26T11:58:10+00:00Added an answer on December 26, 2020 at 11:58 am

      Cool! Thank you all. I learned something new!

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

      artmedia70

      • 1 Question
      • 41 Answers
      • 0 Best Answers
      • 102 Points
      View Profile
      artmedia70
      2020-12-26T11:58:04+00:00Added an answer on December 26, 2020 at 11:58 am

      Igor Makanu:

      checked, will help:

      2019.08.03 15:48:46.362 tst (EURUSD,H1) ENUM_TIMEFRAMES

      2019.08.03 15:48:46.362 tst (EURUSD,H1) ENUM_MY

      Artem confused, in General, the meaning of the explanations was that the reasons for deinitialization are not an enumeration, but they are constants, and
      constants specified via the macro substitution #define, so the example Print(typename(REASON_CLOSE)); and returns the type int

      PS: then the help is a little misleading – my previous post

      All. I understood the meaning of what it was about. Thank you.

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

      igorm

      • 0 Questions
      • 17 Answers
      • 0 Best Answers
      • 54 Points
      View Profile
      igorm
      2020-12-26T11:57:58+00:00Added an answer on December 26, 2020 at 11:57 am

      Artyom Trishkin:

      The post was like this:

      So I was wondering how this line will help in finding the desired enumeration. I didn’t understand for example.

      checked, will help:

      void OnStart()
        {
         enum ENUM_MY{help,help_me,go_away};
         Print(typename(PERIOD_H1));
         Print(typename(help_me));
        }

      2019.08.03 15:48:46.362 tst (EURUSD,H1) ENUM_TIMEFRAMES

      2019.08.03 15:48:46.362 tst (EURUSD,H1) ENUM_MY

      Artem confused, in General, the meaning of the explanations was that the reasons for deinitialization are not an enumeration, but they are constants, and
      constants specified via the macro substitution #define, so the example Print(typename(REASON_CLOSE)); and returns the type int

      PS: then the help is a little misleading – my previous post

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

      artmedia70

      • 1 Question
      • 41 Answers
      • 0 Best Answers
      • 102 Points
      View Profile
      artmedia70
      2020-12-26T11:57:42+00:00Added an answer on December 26, 2020 at 11:57 am

      fxsaber:
      Quickly find the right enum

      Any enum-int. What’s the point?

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

      igorm

      • 0 Questions
      • 17 Answers
      • 0 Best Answers
      • 54 Points
      View Profile
      igorm
      2020-12-26T11:57:36+00:00Added an answer on December 26, 2020 at 11:57 am

      fxsaber:

      OK, thank you

      there was a suspicion that there was enough red in the ME for #define –
      it turns out that you need to check through
      #ifdef

      PS: I recently asked myself a question, in MT4 TRUE works, and in MT5 there will be an error you need to write true, although ME that there that there will highlight TRUE in red, so
      I could not understand how these constants are obtained in MQL

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

      fxsaber

      • 1 Question
      • 54 Answers
      • 0 Best Answers
      • 134 Points
      View Profile
      fxsaber
      2020-12-26T11:57:30+00:00Added an answer on December 26, 2020 at 11:57 am

      Igor Makanu:

      and how did You determine this? (which is a #define )

      Vladimir Simakov:
      But which is fine
      reacts

      #ifdef

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

      simakovva

      • 0 Questions
      • 7 Answers
      • 0 Best Answers
      • 34 Points
      View Profile
      simakovva
      2020-12-26T11:57:25+00:00Added an answer on December 26, 2020 at 11:57 am

      fxsaber:

      Which is not affected by #undef.

      But to which #ifdef responds perfectly

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    8. igorm

      igorm

      • 0 Questions
      • 17 Answers
      • 0 Best Answers
      • 54 Points
      View Profile
      igorm
      2020-12-26T11:57:19+00:00Added an answer on December 26, 2020 at 11:57 am

      Vladimir Simakov:
      This is not an enum, but a #define

      fxsaber:

      Which is not affected by #undef.

      and how did You determine this? (which is a #define )

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    9. simakovva

      simakovva

      • 0 Questions
      • 7 Answers
      • 0 Best Answers
      • 34 Points
      View Profile
      simakovva
      2020-12-26T11:57:09+00:00Added an answer on December 26, 2020 at 11:57 am

      vvebus:

      Who can tell you what the enum of deinitialization reasons is called?

      In other words, to which enum do they refer:

      Constant

      The value

      Description

      REASON_PROGRAM

      0

      Expert
      stopped working by calling the function

       ExpertRemove()

      REASON_REMOVE

      1

      The program
      removed from the chart

      REASON_RECOMPILE

      2

      The program
      recompiled

      REASON_CHARTCHANGE

      3

      Symbol
      or the schedule period has been changed

      REASON_CHARTCLOSE

      4

      Chart
      unopened

      REASON_PARAMETERS

      5

      Input data
      the parameters were changed by the user

      REASON_ACCOUNT

      6

      Activated
      another account or there was a reconnection to the trading server due to a change in the account settings

      REASON_TEMPLATE

      7

      A
      different chart template has been applied

      REASON_INITFAILED

      8

      The OnInit() handler returned
      non-zero value

      REASON_CLOSE

      9

      Terminal
      was closed

      This is not an enum, but a #define

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    10. fxsaber

      fxsaber

      • 1 Question
      • 54 Answers
      • 0 Best Answers
      • 134 Points
      View Profile
      fxsaber
      2020-12-26T11:57:03+00:00Added an answer on December 26, 2020 at 11:57 am

      Quickly find the right enum
      Print(typename(REASON_CLOSE)); // int

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    11. igorm

      igorm

      • 0 Questions
      • 17 Answers
      • 0 Best Answers
      • 54 Points
      View Profile
      igorm
      2020-12-26T11:56:57+00:00Added an answer on December 26, 2020 at 11:56 am

      judging by the function signature void OnDeinit(const int reason) – these are constants, not an enumeration, in the help, as you noticed, also not
      links or specify the name of the enumeration 

      if you want to see the reason for deinitialization in text form
      , I would try to do this:

      enum ENUM_REASON{REASON__PROGRAM,REASON__REMOVE,REASON__RECOMPILE,REASON__CHARTCHANGE,REASON__CHARTCLOSE,REASON__PARAMETERS,REASON__ACCOUNT,REASON__TEMPLATE,REASON__INITFAILED,REASON__CLOSE};

      void OnDeinit(const int reason)
        {
         Print(EnumToString((ENUM_REASON)reason));
        }

      that is, I created a custom enumeration with a list of values similar in name (added an additional sign _ )

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

    Geraldimaky

    Geraldimaky

    • 0 Questions
    • 0 Answers
    Jeffreytix

    Jeffreytix

    • 0 Questions
    • 0 Answers
    RobertFoeta

    RobertFoeta

    • 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