I noticed a difference in the value of BarMaxSpreadInt between how Tickstory calculates it, and how I thought it should be calculated:
I first exported all EURUSD ticks for a whole day (in this case Dec 19th, 2022) in MT5 format from Tickstory, then I exported 1 second bars from Tickstory for the same duration, then I looked at the resulting bars to try to understand how BarMaxSpreadInt is calculated.
The manual says here (https://tickstory.com/help/tickstorylit ... le_exports):
{BarMaxSpreadInt}: - The maximum spread that occurred within a bar, expressed as an integer. For a 4-digit symbol, this will appear as “2” for a 2.1 pip spread and for a 5-digit symbol, it would appear as “21”.
So with that definition, I assumed:
- If a bar only contains 1 tick, the BarMaxSpreadInt of that bar should be the int spread of that tick, right? But that's not how Tickstory calculates it: All bars that contain only 1 tick have a BarMaxSpreadInt of 0 in Tickstory's output! See the blue rectangle here (https://i.imgur.com/g55pZwr.png) which is the only tick that happened during second 04 and the corresponding 1 second bar in Tickstory's output here on the left (https://i.imgur.com/cSSxbCF.png) which has a BarMaxSpreadInt 0. (You can verify this yourself, check any bar that contains only 1 tick, they all have BarMaxSpreadInt = 0.) Btw, that screenshot is from WinMerge, as you can see, all bar values between Tickstory's output and my own calculation are the same except BarMaxSpreadInt (the values I calculated from Tickstory's ticks are shown in the right column).
- If a bar contains multiple ticks, then (in pseudo code) That's apparently also not how Tickstory calculates it. Compare the red rectangle in the above two screenshots: The first image shows that there are 2 ticks within second 02, so the corresponding 1 second bar is made from 2 ticks. The int spread of the first tick is 105850-105844=6, and for the second tick it's 105850-105845=5. The max of 6 and 5 is 6. So I would think that the BarMaxSpreadInt of this bar should be 6, but Tickstory's 1 second bar output contains 5 as the value for BarMaxSpreadInt for this bar (see red rectangle in the other screenshot)!
Code: Select all
BarMaxSpreadInt = max(tick.ask - tick.bid) for tick in ticks
So, can you please explain to me what I'm getting wrong here? How is BarMaxSpreadInt calculated exactly?
I want to understand it, so that I interpret it correctly during backtesting.
(Btw, I also get these discrepancies for exports of any other symbol, any other day and any other bar size (e.g. M1). I just give this example so that you can follow my steps of how I arrived at these values / questions.)