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 2975
Next
In Process
malishko89
malishko89

malishko89

  • 13 Questions
  • 17 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
malishko89
Asked: December 26, 20202020-12-26T13:05:29+00:00 2020-12-26T13:05:29+00:00In: Forex Expert Advisors

help me fix the binding of the expert Advisor to the account number)

  • 0

Hello there!tell me how to write it correctly) so that if the account number does not match when dragging the expert Advisor to the chart,then it gives an error and is not placed on the chart?)

void OnTick()
{
   int Number = AccountNumber(); / / get the account number
if (Number != 602202) / / compare it with the given one, and if not equal,
   {
      Comment("work on the account ", Number," prohibited!"); / / display a comment about the work ban
      }
      return(INIT_FAILED);    
   }
   / / ... further code of the expert Advisor

  • 4 4 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    4 Answers

    • Voted
    • Oldest
    • Recent
    1. malishko89

      malishko89

      • 13 Questions
      • 17 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      malishko89
      2020-12-26T13:05:57+00:00Added an answer on December 26, 2020 at 1:05 pm

      Konstantin Nikitin:

      Special functions

      Event handling functions

      Thanks).I will understand)

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

      iks_

      • 1 Question
      • 28 Answers
      • 0 Best Answers
      • 76 Points
      View Profile
      iks_
      2020-12-26T13:05:47+00:00Added an answer on December 26, 2020 at 1:05 pm

      Pavel Malyshko:

      inserted at the very beginning of the code..

      //+--------------------------------------------------------------------------------+ EXTERNAL INPUTS +---------------+
      //| Expert Check Account owner function                              |
      //+------------------------------------------------------------------+
      bool ExpCheckUser(void)
      {
        if((long)AccountInfoInteger(ACCOUNT_TRADE_MODE) != ACCOUNT_TRADE_MODE_REAL)
           return false;
        if((int)AccountInfoInteger(ACCOUNT_LOGIN) != 123456)
           return false;
        if(AccountInfoString(ACCOUNT_NAME) != "Xxxx Xxxxx Xxxx")
           return false;

        return true;
      }
      //--- Add "extern " before each parameter to get them in the inputs tab
      void OnInit(void)
      {
           if(!ExpCheckUser())
                ExpertRemove();
      }

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

      malishko89

      • 13 Questions
      • 17 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      malishko89
      2020-12-26T13:05:37+00:00Added an answer on December 26, 2020 at 1:05 pm

      prostotrader:


      Raise return(INIT_FAILED); 

      on the line above (immediately after the Comment)

      I would also add the account owner (I still have a demo or real) MT5

      did exactly the same, the expert Advisor is dragged to the chart.. and smiles)
      why?if acc_login I don’t have 123456…

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

      prostotrader

      • 0 Questions
      • 18 Answers
      • 0 Best Answers
      • 60 Points
      View Profile
      prostotrader
      2020-12-26T13:05:33+00:00Added an answer on December 26, 2020 at 1:05 pm

      Pavel Malyshko:
      Hello there!tell me how to write it correctly) so that if the account number does not match when dragging the expert Advisor to the chart,then it gives an error and is not placed on the chart?)

      Raise return(INIT_FAILED); 

      on the line above (immediately after the Comment)

      I would also add the account owner (I still have a demo or real) MT5

      //| Expert Check Account owner function                              |
      //+------------------------------------------------------------------+
      bool ExpCheckUser()
      {
        long acc_login = long(AccountInfoInteger(ACCOUNT_LOGIN));
        string acc_user = AccountInfoString(ACCOUNT_NAME);
        long acc_real = AccountInfoInteger(ACCOUNT_TRADE_MODE);
        if(acc_real == ACCOUNT_TRADE_MODE_REAL)
        {
          if ((acc_login == 123456) && ( acc_user == "Xxxx Xxxxx Xxxx")) return(true);
        }
        return(false);
      }

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

    • savinkins

      Getting data by the indicator from another indicator on a ...

      • 6 Answers
    • fresto

      Error opening the OptimOne file error: 5004

      • 2 Answers
    • asot650

      You need to write an Expert Advisor on the indicator

      • 4 Answers
    • miron_like

      Translation to mql5

      • 1 Answer
    • dynamiteman

      Script for commenting on an MT4 or MT5 trade

      • 2 Answers

    Users

    Brianacink

    Brianacink

    • 0 Questions
    • 0 Answers
    asot650

    asot650

    • 1 Question
    • 2 Answers
    investr777

    investr777

    • 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