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

hoz

  • 16 Questions
  • 22 Answers
  • 0 Best Answers
  • 32 Points
View Profile
  • 0
hoz
Asked: December 27, 20202020-12-27T05:13:28+00:00 2020-12-27T05:13:28+00:00In: Forex Expert Advisors

Why do I need a parameter in TimeLocal() ?

  • 0

I wrote a function:

// 8.1 Returns the value of the specified time in the local time zone. ============================================================================================================
datetime getTimeInLocalTimeZone(datetime date){
  MqlDateTime dt;
  TimeToStruct(date, dt);
  return TimeLocal(dt);
}

I thought that this way I would return the date with the time in the local time zone. But what I do not pass through the parameter, it still returns the time that is at the moment, and not the time that I pass, even if it is some days ago. This raised a question. What is this parameter for?

I thought TimeLocal() that is, without parameters, it returns the current local time, and with TimeLocal(dt) parameters, it returns the time for the date dt. If not, what is the point of this parameter?

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

    7 Answers

    • Voted
    • Oldest
    • Recent
    1. vdev

      vdev

      • 1 Question
      • 42 Answers
      • 0 Best Answers
      • 100 Points
      View Profile
      vdev
      2020-12-27T05:14:05+00:00Added an answer on December 27, 2020 at 5:14 am

      Georgiy Merts:

      Come on… Use the standard carray descendant – and return pointers to yourself.

      The only problem with array pointers in MLQ is the standard timeseries arrays passed to indicators. You can’t take the pointer directly, so you have to copy it. But this is the only case. In all other cases, we use the successor class CArray, and all problems with pointers to arrays disappear.

      Georges, you speak to the vehicle in an alien language )))) Fun forum, soon it will be necessary to call Petrosyan.

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

      hoz

      • 16 Questions
      • 22 Answers
      • 0 Best Answers
      • 32 Points
      View Profile
      hoz
      2020-12-27T05:14:00+00:00Added an answer on December 27, 2020 at 5:14 am

      Dmitiry Ananiev:

      Excuse my ignorance, but in what language does a function return an entire array? As far as I know, C returns a pointer to an array. In MQL, the pointer cannot be returned. Security. Because then you can get into the system memory and do something there. (I may not be quite right here either). 

      In Java, I’ve always worked this way. In C#, too, I think it should be. They’re too similar. Unless there are no delegates in Java..

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

      laryx

      • 0 Questions
      • 43 Answers
      • 0 Best Answers
      • 106 Points
      View Profile
      laryx
      2020-12-27T05:13:55+00:00Added an answer on December 27, 2020 at 5:13 am

      Dmitiry Ananiev:

      Excuse my ignorance, but in what language does a function return an entire array? As far as I know, C returns a pointer to an array. In MQL, the pointer cannot be returned. Security. Because then you can get into the system memory and do something there. (I may not be quite right here either). 

      Come on… Use the standard carray descendant – and return pointers to yourself.

      The only problem with array pointers in MLQ is the standard timeseries arrays passed to indicators. You can’t take the pointer directly, so you have to copy it. But this is the only case. In all other cases, we use the successor class CArray, and all problems with pointers to arrays disappear.

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

      dimeon

      • 2 Questions
      • 25 Answers
      • 0 Best Answers
      • 74 Points
      View Profile
      dimeon
      2020-12-27T05:13:51+00:00Added an answer on December 27, 2020 at 5:13 am

      hoz:

      Thanks. I’ve already figured it out. This is the disadvantage of the MCL as a whole, in terms of not being able to return arrays normally, but only through the parameters of the function. I’m used to working with comfort, but here such moments are present. In addition, the same TimeLocal() function itself is still void. And what is returned through the parameters is already somehow not relevant to this. This is the first thing that can be confusing. I have enough functions. which are themselves void, but return something via parameters. So I didn’t even bother when I read the help.

      Excuse my ignorance, but in what language does a function return an entire array? As far as I know, C returns a pointer to an array. In MQL, the pointer cannot be returned. Security. Because then you can get into the system memory and do something there. (I may not be quite right here either). 

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

      tecciztecatl

      • 0 Questions
      • 10 Answers
      • 0 Best Answers
      • 40 Points
      View Profile
      tecciztecatl
      2020-12-27T05:13:40+00:00Added an answer on December 27, 2020 at 5:13 am

      Note

      If a variable of the MqlDateTime structure type was passed as a parameter , it is filled in accordingly.

      • 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-27T05:13:36+00:00Added an answer on December 27, 2020 at 5:13 am

      Alexey Viktorov:

      Because TimeLocal (dt) does not return a date, but writes it to the dt structure.

      She is a structure…

      Why would that be? Reading..

      Parameters

      dt_struct

      [out]  Variable of the MqlDateTime structure type.

      Return value

      Datetime value

      Return value of datetime. Type of the datetime function. How can a function return nothing?

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

      alexeyvik

      • 1 Question
      • 74 Answers
      • 0 Best Answers
      • 172 Points
      View Profile
      alexeyvik
      2020-12-27T05:13:31+00:00Added an answer on December 27, 2020 at 5:13 am

      hoz:

      I wrote a function:

      I thought that this way I would return the date with the time in the local time zone. But what I do not pass through the parameter, it still returns the time that is at the moment, and not the time that I pass, even if it is some days ago. This raised a question. What is this parameter for?

      I thought TimeLocal() that is, without parameters, it returns the current local time, and with TimeLocal(dt) parameters, it returns the time for the date dt. If not, what is the point of this parameter?

      Because TimeLocal (dt) does not return a date, but writes it to the dt structure.

      Note

      If a variable of the MqlDateTime structure type was passed as a parameter , it is filled in accordingly.

      She is a structure…

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

    Geraldimaky

    Geraldimaky

    • 0 Questions
    • 0 Answers
    Jeffreytix

    Jeffreytix

    • 0 Questions
    • 0 Answers
    RobertFoeta

    RobertFoeta

    • 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