Can we define start/end of year as datetime variable?
Results 1 to 4 of 4

Thread: Can we define start/end of year as datetime variable?

  1. #1
    I am going to backtest kind of annual price levels and in order to becktest it need to plot traces not in Ray arrangement and becouse of number of lines I can not make use of buffer format
    my question is: can we define beginning and end of a year comprised past and current years as timedate factors in mt4
    have you got some other alternatives
    like this that I use for monthly periods:
    Inserted Code Mtime1=iTime(NULL,Mperiod,Mshift); // if (Month()==1 || Month()==3 ||Month()==5 ||Month()==7 || Month()==8 || Month()==10 || Month()==12) Mtime2=Mtime1 (PERIOD_MN1 PERIOD_D1)*60; if (Month()==2) Mtime2=Mtime1 (PERIOD_MN1-PERIOD_D1)*60; if (Month()==4 || Month()==6 || Month()==9 || Month()==11) Mtime2=Mtime1 PERIOD_MN1*60;

  2. #2
    Quote Originally Posted by ;
    I haven't actually done it, but have done similar things.

    Only loe the datetime value for Jan 1st of the subsequent year and subtract 1 (moment ) from the answer to supply you with the end of the last year. Or find the beginning of day of Dec 31 and add 24*60*60-1 to the answer.
    Thank you sir
    plz correct if I am wrong:
    after I calculated 1st of jun then for last year's open I should subtract the value with a continuous and for 2 years befor double the continuous and....
    My question Is the constant

  3. #3
    The way you're suggesting to do it could cause difficulties because of leap years. Just reuse the identical calculation for every single calendar year, should not be too hard.

  4. #4
    I have not really done it, but have done similar things.

    Just loe the datetime value for Jan 1st of the following year and subtract 1 (moment ) in the response to give you the conclusion of the last calendar year. Or discover the beginning of day of Dec 31 and include 24*60*60-1 to the response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.