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 3532
Next
In Process
borfor
borfor

borfor

  • 1 Question
  • 2 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
borfor
Asked: December 26, 20202020-12-26T13:39:09+00:00 2020-12-26T13:39:09+00:00In: Forex Expert Advisors

How to set the date of loading the quote history from the current hour to 72 hours ago.

  • 0

Hello,  

I think the question is very primitive, but it does not work.

There is a script for MT5 that loads the history of quotes for the specified dates to the file. But you need a history of quotes only for the last 72 hours and do not want to change the dates every hour.

Here is the original script

input datetime            start_date     = D’01.10.2018′; // Start Date
input datetime            end_date       = D’01.10.2019′; // End Date

As I logically understand it, start_date is equal to the current date, and end_date = start_date + 72 hours.

Please tell me how to write it.

  • 5 5 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    5 Answers

    • Voted
    • Oldest
    • Recent
    1. borfor

      borfor

      • 1 Question
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      borfor
      2020-12-26T13:39:39+00:00Added an answer on December 26, 2020 at 1:39 pm

      Vitalii Ananev:

      That is, you have this code start_date = TimeCurrent () – 72*3600 – Shows the date 24-hours ago from the current time?

      According to the help, the TimeCurrent() function returns the server time when the last quote for any of the symbols in the “market overview”arrived. At the weekend, quotes are not transmitted to the terminal, perhaps the error is related to this.With

      Thanks!

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

      vitales

      • 1 Question
      • 22 Answers
      • 0 Best Answers
      • 66 Points
      View Profile
      vitales
      2020-12-26T13:39:34+00:00Added an answer on December 26, 2020 at 1:39 pm

      borfor:

      No, TimeCurrent () returns all the correct current time and date

      That is, you have this code start_date = TimeCurrent () – 72*3600 – Shows the date 24-hours ago from the current time?

      According to the help, the TimeCurrent() function returns the server time when the last quote for any of the symbols in the “market overview”arrived. At the weekend, quotes are not transmitted to the terminal, perhaps the error is related to this.

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

      barabashkakvn

      • 7 Questions
      • 162 Answers
      • 0 Best Answers
      • 314 Points
      View Profile
      barabashkakvn
      2020-12-26T13:39:27+00:00Added an answer on December 26, 2020 at 1:39 pm

      borfor:

      Yes, Vitaly, I saw this function, but when I inserted it there was an error. Now I stirred my brains figured out what the error is and now everything works. Thanks!

      The only thing that confuses me is that if I write start_date = end_date-72*3600

      it gives me the last 24 hours, and not 72 as it seems logically should be, and if I write twice as much as 144, then it gives out for the last 96 hours. You can work but it’s strange?

      Check if TimeCurrent() returns a value of 0 (i.e. 1970.01.00)

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

      borfor

      • 1 Question
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      borfor
      2020-12-26T13:39:17+00:00Added an answer on December 26, 2020 at 1:39 pm

      Vitalii Ananev:

      end_date = start_date + 72*3600

      Vitaly, thank you.

      I really messed up a little, end_date should be the current date and time, then start_date will be start_date = end_date-72*3600

      This is understandable. And how to set end_date to the current date and time? If you can show it in the code, the script code is attached. Since I’m trying to just insert this function, but it writes an error when compiling.

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

      vitales

      • 1 Question
      • 22 Answers
      • 0 Best Answers
      • 66 Points
      View Profile
      vitales
      2020-12-26T13:39:13+00:00Added an answer on December 26, 2020 at 1:39 pm

      borfor:

      Hello,  

      I think the question is very primitive, but it does not work.

      There is a script for MT5 that loads the history of quotes for the specified dates to the file. But you need a history of quotes only for the last 72 hours and do not want to change the dates every hour.

      Here is the original script

      input datetime            start_date     = D’01.10.2018′; // Start Date

      input datetime            end_date       = D’01.10.2019′; // End Date

      As I logically understand it, start_date is equal to the current date, and end_date = start_date + 72 hours.

      Please tell me how to write it.

      end_date = start_date + 72*3600

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

    Anthonygrase

    Anthonygrase

    • 0 Questions
    • 0 Answers
    HiramJanny

    HiramJanny

    • 0 Questions
    • 0 Answers
    Geraldimaky

    Geraldimaky

    • 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