[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 216

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
Is this possible? DoC offer to close an order at a better price???? This is the first time I've heard of a brokerage company getting so sloppy.
The robot was not stupid, by definition it cannot be stupid.
It is necessary simply to correct the code, if you want you can lay it out here and you can help here, you can write in your personal message and surely too will help.
1. Yes, it happened - it is clear from the log.
2. I used the word "stupid" in a figurative sense meaning that something was wrong in the code.
3. Here is the code of pose closing:
But the pose doesn't always close, and it's not an error, it's considered normal, a message like this comes from the server:
2009.09.08 00:44:42 '64766': requote 1.51893 / 1.51933 for order #11573500 sell 1.80 EURCHF closing at 1.51914
As you know, this means that the price has changed in the short term while the closing request went to the server.
And the server suggests a new closing price. The server is given time to respond - 3 seconds. And here is the problem - the server refuses to close the order at the new price!
How this happens is not clear... Help me understand, please.
Guys, please explain the meaning of the exclamation mark(!ExistPosition).
if(cnt > 0 && !ExistPosition(OP_BUY) && Ask <= price - PipsForOpenMore * Point)
Guys, please explain the meaning of the exclamation mark(!ExistPosition).
if(cnt > 0 && !ExistPosition(OP_BUY) && Ask <= price - PipsForOpenMore * Point)
literal translation of this line will be
if cnt is MORE than 0 and the ExistPosition(OP_BUY) function returns FALSE and Ask is LESS than or equal to price - PipsForOpenMore * Point, then....
The "!" is a negation. If it were not, the if condition would assume that the ExistPosition(OP_BUY) function should return TRUE.
Hello, Could you please advise how to catch and handle in an EA the event of closing a deal at stoploss or takeprofit. >> Thank you.
Do you want something to be executed before closing on stop/profit?
Do you want something to be executed before closing on stop/profit?
No, right after the close.
OrdersTotal() - will return 0 as soon as the order has been closed.
Accordingly, if OrdersTotal() returns 0, then you do the processing...
This is the case when only one order is open.
If you describe your situation in more details, what you want to do after the order is closed, then I will be able to give you a better answer :)
I don't understand the logic.
Can you explain it more precisely, from an example?
3. Here's the code to close the position:
Increase the slippage value to 50, you have 5 digits, so 0.3 pips doesn't work.
Hello, could you please tell me how to capture and handle in my EA the event of closing a deal at Stop Loss or Take Profit. >> Thank you.
Look at the last order in the history, determine the order type.
For example for a long position:
If the order closed at a price equal to or lower than the stop loss, then it was a stop loss.
If at the price equal to or higher than TakeProfit - TakeProfit.