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

Share your knowledge in the forex community!

Our community is a completely independent place for communication between forex traders and software developers for trading platforms Metatrader 4 and Metatrader 5

Create A New Account
Home/ Questions/Q 279
In Process
viktorternovskiy
viktorternovskiy

viktorternovskiy

  • 3 Questions
  • 6 Answers
  • 0 Best Answers
  • 22 Points
View Profile
  • 0
viktorternovskiy
Asked: December 18, 20202020-12-18T06:47:11+00:00 2020-12-18T06:47:11+00:00

The symbolselect() function hangs the Metatrader for a long time when adding a large number of symbols to MarketWatch.

  • 0

Hello, dear colleagues! Faced with the problem of adding a large number of characters to MarketWatch. I use the symbolselect () function, the code is: 
// get the number of all the broker's instruments
SymbsTotal = SymbolsTotal(false);

//setting the size of the array for tools
ArrayResize(SymbolBuff,SymbsTotal);

//Fill the array with the names of the instuments in the loop
for( int i=0; iSymbolName(i, false);
    
    //Adding a symbol to MarketWatch
    SymbolSelect( SymbolBuff[i], true);
  }
And everything seems to be fine, the code works, but when you add a large number of tools, the Metatrader hangs for dozens of minutes, does not respond to any clicks at all, just freezes. My broker has 4000+ instruments and I want to track certain trading conditions for all of them. The situation would seem to be cheap, you can just turn on the display of all simols in the terminal yourself, but there may be two “Buts”. The first situation is if I suddenly turn off a tool or a group of tools, forgetting that I need to display everything, or I give someone a robot and it turns off the display of symbols in MarketWatch, the expert will simply not receive information on the disabled pairs and, accordingly, will not monitor the situation for entry. are there any other functions or ways to solve this problem how to display all symbols programmatically without hanging the metatrader?

  • 6 6 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    6 Answers

    • Voted
    • Oldest
    • Recent
    1. viktorternovskiy

      viktorternovskiy

      • 3 Questions
      • 6 Answers
      • 0 Best Answers
      • 22 Points
      View Profile
      viktorternovskiy
      2020-12-18T06:47:53+00:00Added an answer on December 18, 2020 at 6:47 am

      In general, after a few days of dancing with a tambourine, I implemented adding one missing symbol per second. And it does not hang and gradually adds everything. If you forget and delete the desired symbol by accident, then everything will be restored within a maximum of a few minutes. So I think it’s not critical.

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

      alexeyvik

      • 1 Question
      • 75 Answers
      • 0 Best Answers
      • 182 Points
      View Profile
      alexeyvik
      2020-12-18T07:04:20+00:00Added an answer on December 18, 2020 at 7:04 am

      Vyktor Ternovskyi:

      Hmm. Just tried it. First, check for availability and only then, if not, there is an addition. I removed 15 tools and the Metatrader hung for 10-15 seconds adding them.. 

      Why do you invent a bicycle with wheels across? That’s exactly the kind of design that doesn’t work.

      if(!symbolinfointeger(symbolbuff[i], SYMBOL_VISIBLE))
      Or your option
      if ( SymbolInfoInteger(SymbolBuff[i], SYMBOL_VISIBLE) == false)

      I can not explain the reason, but I came to this after repeated experiments and misunderstanding of what is happening. Take the entire check block and enter the check and delete instead of the line ” / / and here………” if there is such a need. Or just a message that the symbol is not added.

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

      viktorternovskiy

      • 3 Questions
      • 6 Answers
      • 0 Best Answers
      • 22 Points
      View Profile
      viktorternovskiy
      2020-12-18T06:47:38+00:00Added an answer on December 18, 2020 at 6:47 am

      Alexey Viktorov:

      What’s the alert for? I was talking about adding only missing characters

      Because my broker has more than 4000 + tools and when you close them all (just press a couple of keys, it’s not difficult), adding them programmatically then hangs the metatrader completely for several tens of minutes. Okay, I also, I understand the algorithm and know what can happen and what to do. But if I then distribute this Expert Advisor, then an inexperienced user may not read or forget about such a feature that you can not hide symbols from MarketWatch, otherwise the Metatrader may hang. In short, an embarrassment can come out and a person will think that this robot is crooked, since because of it there are such lags. 

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

      alexeyvik

      • 1 Question
      • 75 Answers
      • 0 Best Answers
      • 182 Points
      View Profile
      alexeyvik
      2020-12-18T07:04:21+00:00Added an answer on December 18, 2020 at 7:04 am

      Or maybe you should first check the presence of the symbol in the market review

        SymbolInfoInteger(SymbolBuff[i], SYMBOL_SELECT);
        SymbolInfoInteger(SymbolBuff[i], SYMBOL_VISIBLE);

      and only then insert?

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

      viktorternovskiy

      • 3 Questions
      • 6 Answers
      • 0 Best Answers
      • 22 Points
      View Profile
      viktorternovskiy
      2020-12-18T06:47:20+00:00Added an answer on December 18, 2020 at 6:47 am

      Maxim Kuznetsov:

      symbolselect does not always succeed immediately 🙁 and the result strongly depends on the DC and the visible type of the account (the Demo is rarely played on MetaQuotes). I’ve been fighting it myself for a few days

      it is necessary to repeat with expectations and in several attempts, while giving control back to MT (that is, exit onTick/OnTimer). That is, you need to make a queue, enter symbols for Watch there, and periodically select from it and try to use symbolselect

      Well, since the situation is complicated, then after thinking about splitting and queuing and understanding that this is also not an ideal option, such an idea came up, why not just check for the presence of the tool and if it is not in MarketWatch, then instead of trying to add it, just issue a notification to the user. having checked such an algorithm even with only a couple of tools included in the market review, all the other 4000+ turned off the algorithm managed in a fraction of a second. Here is a line of code: 

          // Checking a symbol in MarketWatch in a loop
          if ( SymbolInfoDouble(symbolbuff[i], SYMBOL_BID) = 0) Alert("Turn on the display of all symbols in MarketWatch, Clumsy!!!");

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

      nektomk

      • 2 Questions
      • 37 Answers
      • 0 Best Answers
      • 92 Points
      View Profile
      nektomk
      2020-12-18T07:04:21+00:00Added an answer on December 18, 2020 at 7:04 am

      Vyktor Ternovskyi:

      Hello, dear colleagues! Faced with the problem of adding a large number of characters to MarketWatch. I use the symbolselect () function, the code is: 

      And everything seems to be fine, the code works, but when you add a large number of tools, the Metatrader hangs for dozens of minutes, does not respond to any clicks at all, just freezes. My broker has 4000+ instruments and I want to track certain trading conditions for all of them. The situation would seem to be cheap, you can just turn on the display of all simols in the terminal yourself, but there may be two “Buts”. The first situation is if I suddenly turn off a tool or a group of tools, forgetting that I need to display everything, or I give someone a robot and it turns off the display of symbols in MarketWatch, the expert will simply not receive information on the disabled pairs and, accordingly, will not monitor the situation for entry. are there any other functions or ways to solve this problem how to display all symbols programmatically without hanging the metatrader.

      symbolselect does not always succeed immediately 🙁 and the result strongly depends on the DC and the visible type of the account (the Demo is rarely played on MetaQuotes). I’ve been fighting it myself for a few days

      it is necessary to repeat with expectations and in several attempts, while giving control back to MT (that is, exit onTick/OnTimer). That is, you need to make a queue, enter symbols for Watch there, and periodically select from it and try to use symbolselect

      • 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 514
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 921
    • Popular
    • Answers
    • Tags
      • On: December 18, 2020
      • Answers: 16

      How to allow trading at certain times

      • On: December 29, 2020
      • Answers: 16

      Example of implementing the OOP pattern Abstract Factory using MQL5 ...

      • On: December 18, 2020
      • Answers: 15

      EMA with a different formula

      • On: December 29, 2020
      • Answers: 15

      Invitation for algo traders.

      • On: December 29, 2020
      • Answers: 14

      Dear Programmers, do not pass by, help fix the error!

    • atma1
      atma1 added an answer Added activation. Thanks. April 8, 2021 at 6:54 am
    • iks_
      iks_ added an answer Atma1: Good day, dear colleagues. Yesterday I updated VMware to… April 8, 2021 at 6:54 am
    • renat
      renat added an answer Atma1: Good day, dear colleagues. Yesterday I updated VMware to… April 8, 2021 at 6:54 am
    • mvs
      mvs added an answer Renat Fatkhullin: You can not immediately send the received data,… April 8, 2021 at 6:53 am
    • anton_m
      anton_m added an answer Renat Fatkhullin: How much data do you read? You can… April 8, 2021 at 6:53 am
    analytics british company computer developers django employee employer english facebook french google interview javascript language life php proforexea programmer programs pro vsa salary university

    Users

    atma1

    atma1

    • 1 Question
    • 1 Answer
    s22aa

    s22aa

    • 1 Question
    • 1 Answer
    areedbreen

    areedbreen

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