Hi Alain,
I do not think I fully understand you yet. Could you somehow clarify a little bit more? Would be really helpful :)
Hi Alain,
I do not think I fully understand you yet. Could you somehow clarify a little bit more? Would be really helpful :)
...does not close the order after 10 second...
You need to find why. To start with is the code to close the order has been executed but gave an error ?
if order is not None:
or was it not executed at all ?
Hi Alain,
No the order executes perfectly. When I drag it on, it places an buy order. However, when I look in the journal (after it placed an buy order) I see: Buy order placed, and script removed. So somehow, it looks like it seems to think the script is 'done' after placing the buy-order. Does this make sense to you?
Hi Alain,
No the order executes perfectly. When I drag it on, it places an buy order. However, when I look in the journal (after it placed an buy order) I see: Buy order placed, and script removed. So somehow, it looks like it seems to think the script is 'done' after placing the buy-order. Does this make sense to you?
I wasn't talking about the initial order, but the order to close.
Is it really you who coded this script ?
Yes, I really coded this myself. But then again, I am a beginner: The part of placing a buy order also took me a while as well and when I look back at what I coded first it does not make sense either. So, I can imagine the second part (closing the order) does not make sense for an experienced programmer.
Coming back to your question: it does not give an error but does not place the order to close at all. It removes the script after placing the buy order immediately.
Yes, I really coded this myself. But then again, I am a beginner: The part of placing a buy order also took me a while as well and when I look back at what I coded first it does not make sense either. So, I can imagine the second part (closing the order) does not make sense for an experienced programmer.
Coming back to your question: it does not give an error but does not place the order to close at all. It removes the script after placing the buy order immediately.
Ok. So if your code doesn't work as expected you need to track the source of the problem.
What is printed in the log ?
What is the result of a trade request (an order) ?
You are trying to detect "an order", but what you need to close is a position.
Yes, I tried to do so. If I start my trade bot it places the order succesfully. Then I checked the log and it mentions:
1. trade placed succesfully.
2. Script removed.
So what I am trying to say is: I am thinking the script somehow thinks it is done after it placed the buy order and removes the script. So I am trying to seek is an answer on the question: Do I need to adjust my code somehow so that it does not think it is done after the buy order is placed.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone, I am a beginning EA creator and trying to figure out the very basics of creating an EA with MQL5/python. To start off, my EA should place an order when dragging it on the graph and close the trade if it did not hit the SL or TP within 10 seconds (keep in mind I just built this EA for training reasons and I do not think it will be profitable or something haha). So, when I drag this code to the graph, it succesfully places the order, however it immediately seems to remove the script and does not close the order after 10 seconds. Does anybody know how to fix this? I am using the following code:
Many thanks in advance!!