You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Market Replay: Unity Is Strength (II).
First, we’ll prepare the database so that we can insert new records, update existing ones, and search for the records we need. This is the starting point, since the database will provide the interaction layer between all the applications that will be involved in simulating the operation of a real server. Please note this difference. I am not saying that we are going to create a simulated server. We will create a mechanism capable of modeling what would happen on the server in a real trading situation.
This mechanism will allow us to run simulations with positions and pending orders. Although I haven't yet explained how the pending order system will work, it is actually already included in the position indicator's code. All that is needed is to adapt the code, but the operation of the pending order system will be discussed later. Let's start by creating a database. The following figure essentially shows the data we need to store in the database.
Obviously, each of these data elements will correspond to a separate column, and the columns may be distributed across one or more tables. However, for educational purposes, I can combine all the columns into a single table. Before combining all the data into a single table, I wondered whether it really made sense to prepare these values in the Expert Advisor. The thing is, I want to prevent the user from submitting a market order while the replay/simulation system is paused. The most appropriate place to check whether the replay/simulation system is paused is the control indicator.
Author: Daniel Jose