Announcement

Collapse
No announcement yet.

Day of the month

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Day of the month

    Hi

    I'm hoping someone can help me out with this simple indicator.

    Day of the month should be a simple thing to work out, but I'm doing a lot of my back testing in excel and when I export, for some reason, half the dates are not in a usable format so I cannot run my day of the month formula.

    I want my chart to display

    1, 2, 3 for the first 1-3 days of the month
    And -1, -2, -3 for the last, 2nd last etc.

    This way when I export to excel, I dont actually need my date function to identify the 1st day. In excel i've just run a simple formula based on the month. E.g. if the last bar was a different month then 1 etc.

    Hoping someone can help me.

  • #2
    Re: Day of the month

    strewthmate
    If exporting dates is the issue [more than likely because you are using a different date format than the US eg 13/1/2011 instead of 1/13/2011] you could just write a simple formula that returns rawtime(0) [which is essentially UNIX time ie the number of seconds elapsed from January 1st 1970] and then in Excel use the following formula



    to convert that value to a date where A1 is the cell containing the value returned by your script, 86400 is the number of seconds in a day and "1/1/70" is the UNIX reference date. Note that the cell in which I convert the time is formatted as Date
    Alex


    Originally posted by strewthmate
    Hi

    I'm hoping someone can help me out with this simple indicator.

    Day of the month should be a simple thing to work out, but I'm doing a lot of my back testing in excel and when I export, for some reason, half the dates are not in a usable format so I cannot run my day of the month formula.

    I want my chart to display

    1, 2, 3 for the first 1-3 days of the month
    And -1, -2, -3 for the last, 2nd last etc.

    This way when I export to excel, I dont actually need my date function to identify the 1st day. In excel i've just run a simple formula based on the month. E.g. if the last bar was a different month then 1 etc.

    Hoping someone can help me.

    Comment

    Working...
    X