Aligning Market Dates Before Calculating Trend Signals
Summary
The document presents a data-handling question about price series whose fields, such as highs, opens, and closes, have different observation dates. The mismatch creates difficulty when comparing a recent price with rolling highs and lows for a trend-following strategy. The data provider supplies moving averages that account for the date inconsistencies, but the questioner is unsure how to handle other indicators.
Two possible treatments are raised: omit observations that do not align with the intended date, or carry the previous value forward into missing dates. The document contains no answer, tested procedure, or performance evidence, so it does not establish which treatment is appropriate. The choice depends on what each date represents and on the indicator being calculated; carrying values forward can create artificial repeated observations, while dropping data can leave gaps or reduce the sample. The central lesson is to resolve timestamp alignment consistently before calculating signals, while recognizing that the source data's date conventions are not explained here.
Key ideas
- Price fields can refer to different dates, complicating comparisons with rolling highs and lows.
- The question raises omission and previous-value carry-forward as possible ways to handle missing aligned observations.
- The document gives no recommendation or evidence comparing these treatments.
- Date conventions should be understood before constructing trend indicators from the series.
Tags
Full text
# Dealing with misaligned dates for trend-following strategy? # Dealing with misaligned dates for trend-following strategy? This is a bit of a naive question, but I figured it couldn't hurt to ask. I have time series data that looks like: ``` PHP HIGH DATE PHP HIGH PHP.OPENDATE PHP OPEN PHP.CLOSEDATE PHP.CLOSE 8/28/2003 2.935 9/2/2003 2.9855 9/1/2003 2.9865 8/27/2003 2.9503 9/1/2003 2.979 8/29/2003 2.976 8/26/2003 2.9813 8/29/2003 2.957 8/28/2003 2.955 8/25/2003 2.978 8/28/2003 2.9561 8/27/2003 2.9561 8/22/2003 2.984 8/27/2003 2.9748 8/26/2003 2.987 8/21/2003 2.992 8/26/2003 2.9915 8/25/2003 2.9955 8/20/2003 2.9825 8/25/2003 2.988 8/22/2003 2.9865 8/19/2003 2.976 8/22/2003 3.0035 8/21/2003 2.999 ``` The dates are misaligned, and I was wondering what the best way of dealing with this would be. I already have 20MA,50MA downloaded from the source, which adjusts the moving averages to account for these inconsistencies. However, I run into problems if I want to compare last prices to 20-day highs/lows. I'm thinking of implementing either the two following options: - Should I omit the variables that are misaligned by the dates? In this case, I would omit the observed values for 9/2,9/1,29 for PHP open prices and 8/29 for PHP Close. - Should I fill in the missing values with the previous value?
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.