Could you confirm if the construction of candlesticks using raw price data, with a shift in start time even by just 1 second, can indeed result in completely different candlesticks?
Of course! Suppose we want to show that the pair of 1M candlesticks (green, red), becomes the pair of (red, green) after shifting the start time of candlesticks by 1 second forward.
For simplicity, let's assume also that frequency of price updates is 1 second.
Condition for candle being green: Close - Open > 0
Condition for candle being red: Close - Open < 0
Let Close(1), Open(1) - close and open prices of the first candlestick,
Close(2), Open(2) - of the second candlestick
The original pair (green, red), implies that Close(1) - Open(1) > 0, Close(2) - Open(2) < 0
The new pair (red, green), implies that Close(1) - Open(1) < 0, Close(2) - Open(2) > 0
Let newOpen(1) - first second observation of the first candlestick, newOpen(2) - first second observation of the second candlestick. newOpen(3) - first second observation of the third candlestick
Our hypothesis is true if the following conditions are met (check yourself):
newOpen(2) < newOpen(1) < High(1) and
NewOpen(3) > NewOpen(2) > Low(2)
Constructing candles:
Suppose that OHLC(1) = (100, 107, 95, 104). Clearly 104-100 > 0. Green candle.
OHLC(2) = (104, 106, 95, 100). 100 - 104 < 0. Red candle
Suppose newOpen(1) - 106, newOpen(2) - 98, newOpen(3) - 102
So we get:
newOHLC(1) = (106, 107, 95, 98). Red candle
newOHLC(2) = (98, 106, 95, 102). Green candle.