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 2407
Next
In Process
marys_fals
marys_fals

marys_fals

  • 1 Question
  • 1 Answer
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
marys_fals
Asked: December 26, 20202020-12-26T12:16:03+00:00 2020-12-26T12:16:03+00:00In: Forex Expert Advisors

Error ” cannot set millisecond timer(100)”

  • 0

Hello there! The client encountered the error “cannot set millisecond timer(100)”when working with my expert Advisor. This happened for the first time in the history of the adviser. I studied the forum, but I didn’t find an answer to my question. I would like to know what the error can be here at all, that is, where to dig, what to ask. Thanks!

  • 8 8 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    8 Answers

    • Voted
    • Oldest
    • Recent
    1. prostotrader

      prostotrader

      • 0 Questions
      • 16 Answers
      • 0 Best Answers
      • 56 Points
      View Profile
      prostotrader
      2020-12-26T12:16:51+00:00Added an answer on December 26, 2020 at 12:16 pm

      Yury Kirillov:

          I added in OnInit():

            int err=-1;
            int
      count=5;
            {while((err!=0)&&(count>0))
            {
              

      ResetLastError();
               EventSetMillisecondTimer(MSTimerSet);                    //Installation
      timer XXX milliseconds

               err=GetLastError();
              

      Print(“EventSetMillisecondTimer n=”,count,”
      err >>”
      ,err);
               {if(err!=0){Sleep(50);}}
            }}//while((err!=0)&&(count>0))

      No need for any cycles, do so and everything will work perfectly

      //+------------------------------------------------------------------+
      //|                                                    Timer_set.mq5 |
      //|                                     Copyright 2019, prostotrader |
      //|                                             |
      //+------------------------------------------------------------------+
      #property copyright "Copyright 2019, prostotrader"
      #property link      "
      #property version   "1.00"
      //+------------------------------------------------------------------+
      //| Expert initialization function                                   |
      //+------------------------------------------------------------------+
      bool t_set;
      //---
      int OnInit()
      {

        t_set = EventSetMillisecondTimer(1000);
        if(t_set = false)
        {
          Alert("Timer not set!");
          return(INIT_FAILED);
        }  
        return(INIT_SUCCEEDED);
      }
      //+------------------------------------------------------------------+
      //| Expert deinitialization function                                 |
      //+------------------------------------------------------------------+
      void OnDeinit(const int reason)
      {
        if(t_set = true) EventKillTimer();
      }

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

      mosaddeqi

      • 0 Questions
      • 1 Answer
      • 0 Best Answers
      • 22 Points
      View Profile
      mosaddeqi
      2020-12-26T12:16:46+00:00Added an answer on December 26, 2020 at 12:16 pm

      Yury kirillov :

          I added to OnInit ():

             int err = – 1
      ; int count = 5 ;
            {

      while ((err! = 0 ) && (count>
      0
      ))       { ResetLastError ();
      EventSetMillisecondTimer

      (MSTimerSet);                    

      // Set the timer XXX milliseconds
               err =

      GetLastError (); Print (
      “EventSetMillisecondTimer n =”
      , count, “err >>” , err);
               {

      if (err! = 0 ) { Sleep
      ( 50 );}}       }}
            


              
              


              



      // while ((err! = 0) && (count> 0))

      Hi guys,

      I use
      the iCustom () function in my expert Advisor, and when I attach it to the chart, “can’t set timer (1)” is shown in the expert tab!

      I added this code to the OnInit () function, but the problem is still not solved!

      Please help me!

      Thank you for your feedback in advance!

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

      falkovds

      • 0 Questions
      • 2 Answers
      • 0 Best Answers
      • 24 Points
      View Profile
      falkovds
      2020-12-26T12:16:37+00:00Added an answer on December 26, 2020 at 12:16 pm

      Let me explain how I see the problem.

      I connect to the VPS via mstsc. I start the terminal, and in it I start the robot, which works on a timer. The timer may throw an error for unknown reasons. Or it may not give out, but start.

      This loop tries to set the timer until it starts and returns the error ” 0 ” (this probability is preserved, and you can start it on the nth attempt). As soon as this happens, the loop ends and the program goes into a timer. Once again, the timer works, but for some reason it may give an error and go further. Without this loop, you can get an error at the initialization stage and switch to a non-working timer, which is unacceptable.

      Then I see whether the timer has been initialized or not and decide what to do next. It is clear that I will not run the program and leave it on its own without making sure that it has at least started (passed the initialization stage). As soon as the timer is started, it already works without problems, and the program can be left disconnected from the VPS.

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

      marketeer

      • 1 Question
      • 33 Answers
      • 0 Best Answers
      • 92 Points
      View Profile
      marketeer
      2020-12-26T12:16:27+00:00Added an answer on December 26, 2020 at 12:16 pm

      Dmitriy Falkov:

      Then so be it:

         int error=-1;
         int counter=1;
         do
         {
         }
         while(error!=0 && !IsStopped());

      An infinite loop? Well, well.

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

      falkovds

      • 0 Questions
      • 2 Answers
      • 0 Best Answers
      • 24 Points
      View Profile
      falkovds
      2020-12-26T12:16:22+00:00Added an answer on December 26, 2020 at 12:16 pm

      Then so it is:

         int error=-1;
         int counter=1;
         do
         {
            ResetLastError();
            EventSetMillisecondTimer(Timer);
            error=GetLastError();
            Print(“EventSetMillisecondTimer. Attempt=”,counter,” Error=”,error);
            if(error!=0) Sleep(1000);
            counter++;
         }
         while(error!=0 && !IsStopped());

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

      marys_fals

      • 1 Question
      • 1 Answer
      • 0 Best Answers
      • 20 Points
      View Profile
      marys_fals
      2020-12-26T12:16:16+00:00Added an answer on December 26, 2020 at 12:16 pm

      Yury Kirillov:
          I added in OnInit():
            int err=-1;
            int count=5;
            {while((err!=0)&&(count>0))
            {
               ResetLastError();
               EventSetMillisecondTimer(MSTimerSet);                    //Setting the timer to XXX milliseconds
               err=GetLastError();
               Print(“EventSetMillisecondTimer n=”,count,” err >>”,err);
               {if(err!=0){Sleep(50);}}
            }}//while((err!=0)&&(count>0))

      Thanks!))

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

      kirillovyv

      • 0 Questions
      • 3 Answers
      • 0 Best Answers
      • 26 Points
      View Profile
      kirillovyv
      2020-12-26T12:16:12+00:00Added an answer on December 26, 2020 at 12:16 pm

      Maria Baburina:
      Hello there! The client encountered the error “cannot set millisecond timer(100)”when working with my expert Advisor. This happened for the first time in the history of the adviser. I studied the forum, but I didn’t find an answer to my question. I would like to know what the error can be here at all, that is, where to dig, what to ask. Thanks!

          I added in OnInit():
            int err=-1;
            int count=5;
            {while((err!=0)&&(count>0))
            {
               ResetLastError();
               EventSetMillisecondTimer(MSTimerSet);                    //Setting the timer to XXX milliseconds
               err=GetLastError();
               Print(“EventSetMillisecondTimer n=”,count,” err >>”,err);
               {if(err!=0){Sleep(50);}}
            }}//while((err!=0)&&(count>0))

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

      barabashkakvn

      • 7 Questions
      • 162 Answers
      • 0 Best Answers
      • 314 Points
      View Profile
      barabashkakvn
      2020-12-26T12:16:06+00:00Added an answer on December 26, 2020 at 12:16 pm

      There is a very similar topic: cannot set millisecond timer (500)

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

    Leonardcig

    Leonardcig

    • 0 Questions
    • 0 Answers
    DennisByday

    DennisByday

    • 0 Questions
    • 0 Answers
    Haroldmeary

    Haroldmeary

    • 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