I'm trying to match a signals.csv dataset with a second dataset that contains a time series. I want to match the timestamps and merge the different datasets into a single one.

I had the idea to export wdate() as one of the signals, but ended up with confusing time differences of as much as 52 days.


I wrote this function in R to convert from wdate format to
POSIXct (the common Time Format in R):

Code:
Sys.setenv(TZ='UTC')
wdate2posixct <- function(wdate)
{
  #Zorro Manual: http://zorro-trader.com/manual/en/month.htm
  #Date and time of the given bar in Windows DATE format.
  #Days are represented by whole number increments starting with 30 December 1899, midnight UTC.
  #The time of the day is represented in the fractional part of the number.
  #This format allows easy and precise date comparison down to a microsecond (= 0.000001/(24*60*60)). 
  
  return (as.POSIXct("1899-12-30",format = "%Y-%m-%d") + ddays(wdate))
  
}




I just did this to create the CSV file:

Code:
adviseLong(SIGNALS,0,wdate(),sig1,sig2,sig3,sig4);



sig1..sig4 being some pricedata related signals

What I want is this format in the CSV file:

Timestamp of when the trade was entered in wdate format,other stuff, profit of a Long trade.

Any suggestions for an approach with reliable timestamps?

Last edited by sdh309795gaas; 08/13/18 12:11.