I need some help from an experienced developer.
I would like to do the following:
1. Create a database in memory in "OnTick".
2. Do one query from defined StartTime to Timecurrent() and copy all the transactions to above database.
Benefit is much less interaction with main server, less lag and much less slippage.
3. Do all my normal queries on the above database on the local PC/Server in stead of doing multiple queries to the trading server.
4. After 3 - then place the necessary trades, Stop losses etc.
5. Delete the database.... and start over at 1....
When browsing through the forums, all I see are loops, doing multiple single queries..... e.g.
for(int pos= PositionsTotal(); pos>=0; pos--)
.......
When speed and lag is important, the above method is highly inefficient.
Any help and sample code is greatly appreciated.
Thanks.
Hi Dominique,
I am not sure you are correct.
When looking at the following link......
https://www.mql5.com/en/docs/database/databasetransactionbegin
They read 2737 transactions in 48.5ms.
Hence, creating the database and populating it with one query is much faster than multiple single queries.
So I am not sure you are correct in your assumption - except if I am interpreting the data wrong in the above example.
The main purpose is to do one query which gives all the data.. and then to do the individual queries on the local database with no lagtime.
Please advise.
- www.mql5.com
Hi Dominique,
I am not sure you are correct.
When looking at the following link......
https://www.mql5.com/en/docs/database/databasetransactionbegin
They read 2737 transactions in 48.5ms.
Hence, creating the database and populating it with one query is much faster than multiple single queries.
So I am not sure you are correct in your assumption - except if I am interpreting the data wrong in the above example.
The main purpose is to do one query which gives all the data.. and then to do the individual queries on the local database with no lagtime.
Please advise.
No, the database "idea" is much too slow. Instead focus on making your code more efficient in terms of when and how you query the trade data.
There is no need to query or loop over the trade data on every single tick. You need to be selective about it.
However, we cannot provide a generalised solution, because it depends on your strategy and other factors.
If you need help with your code, then show your code.
I need some help from an experienced developer.
I would like to do the following:
1. Create a database in memory in "OnTick".
2. Do one query from defined StartTime to Timecurrent() and copy all the transactions to above database.
Benefit is much less interaction with main server, less lag and much less slippage.
3. Do all my normal queries on the above database on the local PC/Server in stead of doing multiple queries to the trading server.
4. After 3 - then place the necessary trades, Stop losses etc.
5. Delete the database.... and start over at 1....
When browsing through the forums, all I see are loops, doing multiple single queries..... e.g.
for(int pos= PositionsTotal(); pos>=0; pos--)
.......
When speed and lag is important, the above method is highly inefficient.
Any help and sample code is greatly appreciated.
Thanks.
What are you talking about ?
PositionsTotal() is a local, it has nothing to do with the trading server.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I need some help from an experienced developer.
I would like to do the following:
1. Create a database in memory in "OnTick".
2. Do one query from defined StartTime to Timecurrent() and copy all the transactions to above database.
Benefit is much less interaction with main server, less lag and much less slippage.
3. Do all my normal queries on the above database on the local PC/Server in stead of doing multiple queries to the trading server.
4. After 3 - then place the necessary trades, Stop losses etc.
5. Delete the database.... and start over at 1....
When browsing through the forums, all I see are loops, doing multiple single queries..... e.g.
for(int pos= PositionsTotal(); pos>=0; pos--)
.......
When speed and lag is important, the above method is highly inefficient.
Any help and sample code is greatly appreciated.
Thanks.