Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1124
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
We need it to set a stop for all open orders at a given price. For example, three orders are opened and a stop, for example 1.32511, is written in the Expert Advisor... This is how it should be)
Hi guys, can you explain me the logic of the server->terminal->advisor? I have this question because of the error handling function in the EA. As far as I understood it from the tutorial, TIC is: SERVER ---> transmits price quotes ---> TERMINAL ---> gives control to EA ---> ADVISOR (processed tick-cycle) ---> backwards in short.
QUESTION: In the beginning, when the server transmits a quote, is it just a quote, or in this TICK-cycle there is immediately a data on various errors on the server (if it happens of course) ?
It's hard to program without understanding the logic
Hi guys, can you explain me the logic of the server->terminal->advisor? I have this question because of the error handling function in the EA. As far as I understood it from the tutorial, TIC is: SERVER ---> transmits price quotes ---> TERMINAL ---> gives control to EA ---> ADVISOR (processed tick-cycle) ---> backwards in short.
QUESTION: In the beginning, when the server transmits a quote, is it just a quote, or in this TICK-cycle there is immediately a data on various errors on the server (if it happens of course) ?
It's hard to program without understanding the logic
Errors come regardless of ticks.
I don't understand then. The error handling functions are only needed for trading cases, do I understand correctly? Is it before opening an order or before modifying an order. Is this correct? I.e., before opening an order, I should first make sure that there are no errors on the server; if there are, I open the order?
My EA has always been sending orders without any error messages, probably because of my EA's stubbornness. It may be because of this my EA was not allowed to trade. I don't know how to do it, I have to do it with an Expert Advisor, but I don't know how to do it.
If errors come regardless of errors, thenGetLastError() itself asks the server if there are errors?
I don't understand then. The error handling functions are only needed for trading cases, do I understand correctly? Is it before opening an order or before modifying an order. Is this correct? I.e., before opening an order, I should first make sure that there are no errors on the server; if there are, I open the order?
My EA has always been sending orders without any error messages, probably because of my EA's stubbornness. It may be because of this my EA was not allowed to trade. I don't know what to do with them, I have to ask them for help and I have to ask them for details.
If errors come regardless of errors, thenGetLastError() itself asks the server if there are errors?
Well, there are no client-side errors on the server, not at all, never, anywhere, understand that for starters.
The server returns a numerical code in response to a client's trade order, that's all. Code 0 - it's OK, the command went through without any problems. Code greater than zero - there are problems, the terminal logs the error code and decryption.
The processing of the return code of the server must not only be considered in the Expert Advisor, the programmer must consider the errors before sending the command to the server and prevent the sending of wrong values in the trade orders that will lead to errors. Then, trading using EAs will not get banned. Otherwise you will get a signature.
Example: There is not enough money in the account to buy 1 lot of Euro, the Expert Advisor does not consider this and bombs the server with orders to buy 1 lot every tick. Naturally, the server will at best set the account to manual mode.
If the Expert Advisor first checks the margin required for buying 1 lot, then it compares this value to the available funds in the account, and if it sees that the funds are not enough, it will not trade, and instead warns the trader, then everything is OK, this is an example of good behavior.
You should consider all possible error conditions, correct the value where possible, and block trades where not possible, and issue a warning to the trader about the problems.
I don't understand it then. The error handling functions are only needed for trading cases, do I understand correctly? Is it before opening an order or before modifying an order. Is this correct? I.e., before opening an order, I should first make sure that there are no errors on the server; if there are, I open the order?
My EA has always been sending orders without any error messages, probably because of my EA's stubbornness. It may be because of this my EA was not allowed to trade. I don't know what to do with them, I have to ask them for help and they have to ask me.
If errors come regardless of errors, thenGetLastError() itself asks the server if there are errors?
The principle: about to make a trading operation, logically we must understand "will there be enough money for the transaction? The next step: "Is it the right level for the order, or will the distance allow it or not? - check. This is a check on your side not to touch the server.
Next: checks passed and passed successfully - we send an order to the server and wait for response, functionGetLastError() receive a response from the server, if there is no error "0", if there are errors, it returns the error code, respectively, and returns your order for revision. Further, the task is to deal with received error and decide whether to re-bombard the server or just calm down. Error codes are in the help.
PS. as I was writing, you've already replied)
Vitalie Postolache andVitaly Muzichenko, a big human THANK YOU! )) Imagine, I finally got it.)
Fine) Then let me add. Imagine the situation: your brokerage company quotes till 23-59 on Friday, but trade requests are processed only till 23-50. You have an EA and its stochastics are crossed somewhere and it starts to send requests to the server and gets "Market is closed" error, but the ticks keep ticking and it sends orders again on every tick, no check. Do you think the server will like it? This kind of things should also be considered.
I already got it, and on this thanks, before any trade order already prescribed error handling function everywhere, but now I'm stuck in a loop and how to brake the EA, if there will be errors just because of my error, and where exactly to prescribe. I.e. I have tried to open an order, but an error has occurred, how to get it? For example OrderSend(....); made a transaction, how do I get infos if it worked successfully?
Can you open the help for the function and see what it returns? And _LastError?
Specifically OrderSend returns an order ticket or -1. Guess in which case it will be -1 on your own ;)