Discussing the article: "Developing a Replay System — Market simulation (Part 23): FOREX (IV)"

 

Check out the new article: Developing a Replay System — Market simulation (Part 23): FOREX (IV).

Now the creation occurs at the same point where we converted ticks into bars. This way, if something goes wrong during the conversion process, we will immediately notice the error. This is because the same code that places 1-minute bars on the chart during fast forwarding is also used for the positioning system to place bars during normal performance. In other words, the code that is responsible for this task is not duplicated anywhere else. This way we get a much better system for both maintenance and improvement.

In the previous article, "Developing a Replay System — Market simulation (Part 22): FOREX (III), we made some changes to the system to enable the simulator to generate information based on the Bid price, and not just based on Last. But these modifications did not satisfy me, and the reason is simple: we are duplicating the code, and this does not suit me at all.


However, since the code for the article was ready and the article was almost completed, I left everything as is, but this really bothered me. It makes no sense for code to work in some situations and not in others. Even debugging the code and trying to find the cause of the error, I could not find it. But after leaving the code alone for a moment and looking at the system flowchart (yes, you should always try to use a flowchart to speed up coding), I noticed that I could make some changes to avoid code duplication. And to make matters worse, the code was actually duplicated. This caused a problem that I could not solve. But there is a solution, and we will start this article with a solution to this problem, since its presence can make it impossible to correctly write simulator code to work with forex market data.

Author: Daniel Jose