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

hoz

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

Is it not possible to unload the indicator from the chart if initialization fails?

  • 0

Usually, I unload the bot, if it is impossible to create a Turkey handle with which you need to work so writing such lines in OnInit():

  MqlParam inputParameters[];
  setInputParameters(inputParameters, "INDICATOR NAME", i_ZZ_tf);
  if (!createHandle(inputParameters)) {
    int retCode = MessageBox("Indicator '" + inputParameters[0].string_value + "' wasn't created", "", MB_OK | MB_ICONSTOP);
    if (retCode == IDOK)
      ExpertRemove();
  }
Everything works as it should.

I tried this in the indicator and.. it doesn’t work. Although, the help says that this is not recommended, but that it does not work.. not said. And I, in General, do not care that this will suspend the flow, because if the Turkey is not initialized, then the bot will not trade. Moreover, as I understand it, then it will pause only for this Turkey, and not for everyone in the terminal.

So it’s weird.

I rewritten it differently:

if (!createHandle(inputParameters)) {
  return INIT_FAILED;
}
All the same, the indicator is not unloaded.
How to force it to be unloaded in case of not successful initialization? After all, this is not adequate. Why would a Turkey hang on the chart if it couldn’t initialize? For example, I have an indicator that is used in another to calculate and draw levels. If the first one was not initialized, then the other one will not show the necessary values…

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

    7 Answers

    • Voted
    • Oldest
    • Recent
    1. alexeyvik

      alexeyvik

      • 1 Question
      • 74 Answers
      • 0 Best Answers
      • 172 Points
      View Profile
      alexeyvik
      2020-12-26T13:57:03+00:00Added an answer on December 26, 2020 at 1:57 pm

      Sergey Savinkin:

      Does this work in MT5 too?

      In mql5, there is no need to specify this, there is initially in strict mode

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

      tecciztecatl

      • 0 Questions
      • 10 Answers
      • 0 Best Answers
      • 40 Points
      View Profile
      tecciztecatl
      2020-12-26T13:56:58+00:00Added an answer on December 26, 2020 at 1:56 pm

      Sergey Savinkin:

      About “works” I remembered an anecdote:

      Two policemen are driving in a car. One says:

      – Something we have a flashing light is buggy. Look, does it work?

      The second leans out of the window, looking at the roof:

      – Works – does not work, works – does not work…

      I checked it again – it doesn’t work)

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

      savinkins

      • 0 Questions
      • 13 Answers
      • 0 Best Answers
      • 46 Points
      View Profile
      savinkins
      2020-12-26T13:56:46+00:00Added an answer on December 26, 2020 at 1:56 pm

      Taras Slobodyanik:

      everything is unloaded if specified

      #property strict

      Does this work in MT5 too?

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

      tecciztecatl

      • 0 Questions
      • 10 Answers
      • 0 Best Answers
      • 40 Points
      View Profile
      tecciztecatl
      2020-12-26T13:56:42+00:00Added an answer on December 26, 2020 at 1:56 pm

      Viktar Dzemikhau:

      Logically, if the return from OnInit() is, for example, INIT_FAILED, then logically you need to unload everything from the graph. Then there is no reason to continue to do something. Otherwise, it turns out absurd. For example, do this:

      everything is unloaded if specified

      #property strict

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

      mvs

      • 0 Questions
      • 51 Answers
      • 0 Best Answers
      • 140 Points
      View Profile
      mvs
      2020-12-26T13:56:34+00:00Added an answer on December 26, 2020 at 1:56 pm

      Viktar Dzemikhau:
      Nope. They didn’t come back)) Sergey, here the question is different. I’m not a fan of using indicators, so I don’t really work with them.

       But I had to because I was writing a complicated algorithm and constantly shoveling certain operations is not an option. How to remove a Turkey from the chart I already understood. There is also a ChartIndicatorDelete function()

      Current all the same, some nonsense turns out. I’ll explain what I think. For example, here is the type OnInit() such an abstract:

      All variants of what the initialization method returns are worthless in the full sense of the word. This is not a reproach to developers, but even advice.

      Logically, if the return from OnInit() is, for example, INIT_FAILED, then logically you need to unload everything from the graph. Then there is no reason to continue to do something. Otherwise, it turns out absurd. For example, do this:

      The absurdity is that the string:

      it’s like an extra one here. It should be on the mind to immediately unload everything, because initialization was crowned with failure..

      If it fails, you can try several more initialization attempts.

      The current algorithm works correctly!

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

      hoz

      • 16 Questions
      • 22 Answers
      • 0 Best Answers
      • 32 Points
      View Profile
      hoz
      2020-12-26T13:56:29+00:00Added an answer on December 26, 2020 at 1:56 pm

      Sergey Savinkin:

      So we’re back to the good old topic. )))))

      Nope. They didn’t come back)) Sergey, here the question is different. I’m not a fan of using indicators, so I don’t really work with them.

       But I had to because I was writing a complicated algorithm and constantly shoveling certain operations is not an option. How to remove a Turkey from the chart I already understood. There is also a ChartIndicatorDelete function()

      Current all the same, some nonsense turns out. I’ll explain what I think. For example, here is the type OnInit() such an abstract:

      int OnInit(){
      line 1
      line 2
      line 3
      ..
      line 4 .
      .
      line 5
      }

      All variants of what the initialization method returns are worthless in the full sense of the word. This is not a reproach to developers, but even advice.

      Logically, if the return from OnInit() is, for example, INIT_FAILED, then logically you need to unload everything from the graph. Then there is no reason to continue to do something. Otherwise, it turns out absurd. For example, do this:

        IndicatorSetString(INDICATOR_SHORTNAME, "m_IndicatorName");
        MqlParam inputParameters[];
        setInputParameters(inputParameters, "_myIndicators/ZigZag_HightLow_MTF", i_ZZ_tf);
        if (!createHandle(inputParameters)) {
          ChartIndicatorDelete(0, 0, "m_IndicatorName");
          return INIT_FAILED;
        }

      The absurdity is that the string:

      ChartIndicatorDelete(0, 0, "m_IndicatorName");

      it’s like an extra one here. It should be on the mind to immediately unload everything, because initialization was crowned with failure..

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

      savinkins

      • 0 Questions
      • 13 Answers
      • 0 Best Answers
      • 46 Points
      View Profile
      savinkins
      2020-12-26T13:56:24+00:00Added an answer on December 26, 2020 at 1:56 pm

      So we’re back to the good old topic. )))))

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

    • starleynsk

      SYMBOL_POINT or how to get the tick size

      • 2 Answers
    • avos

      What's wrong? possible loss of data due to type conversion

      • 5 Answers
    • worh

      pass a value from one Expert Advisor to another

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

    Users

    Lindatar

    Lindatar

    • 0 Questions
    • 0 Answers
    sgarnov

    sgarnov

    • 0 Questions
    • 1 Answer
    alexandrim

    alexandrim

    • 0 Questions
    • 1 Answer

    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