Rounding OHLC Data for Strategy Backtests and Live Trading
Summary
The document raises a data-quality question about using hourly OHLC prices for a cryptocurrency in strategy research. Its supplied dataset carries more decimal places than the values displayed by a chart, and the author asks whether to round the historical values to match the chart's apparent precision before defining and backtesting a strategy. The practical concern is that live orders can only be submitted at the exchange's supported price increments, so execution prices may need rounding.
No answer or test is included, so the document does not establish which price source is correct or whether rounding improves a backtest. It gives a discrepancy example but no evidence about its cause, such as differences in data vendors, candle construction, or display formatting. It therefore serves as a prompt about consistent data and executable price precision; readers would need to verify market rules and model live order rounding and execution constraints explicitly.
Key ideas
- The question concerns mismatched precision between hourly OHLC data and chart-displayed prices.
- The author asks whether to round historical prices before defining and testing a strategy.
- Live orders may be constrained by the instrument's permitted price increments.
- No answer is provided to determine the source of the discrepancy or recommend a rounding method.
Tags
Full text
# Should I always round the data before even trying defining and backtesting my trading strategy? # Should I always round the data before even trying defining and backtesting my trading strategy? Newbie here, it happens that I have 8 months of OHLC price data set at 1 hour timeframe from a particular cryptocurrency (ticket) called `ALICE`, here's a little sample of those: The first column above represent the timestamp of the open price, the next 4 columns represent the OHLC price values (set in USD), and the next to the next column represents the timestamp of the close price. In this case, the last row in the dataframe above has the following OHLC values: ``` O = 7.56459843 H = 7.70936971 L = 7.45377539 C = 7.68385709 ``` Now, if we look for the corresponding candle to that row in this chart we get the following candle in the picture down below: And that candle has the following OHLC values: ``` O = 7.557 H = 7.709 L = 7.444 C = 7.681 ``` So, as can be seen, the OHLC values I have do not exactly match with the OHLC values displayed in the chart. So, I want to know if I just should round (up or down) every single OHLC value in my dataframe up to having 3 decimal points, before starting the definition and backtest of any trading strategy on this? Or, should I actually work with the data as were delivered to me? Keep in mind that, obviously, when trying whatever strategy on live trading, the bot could only set prices up to 3 decimal points, so it would have to round the values anyway
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.