EA Question - Close the order if reversal or the same signal occured

Back to topics list To post a new topic, please log in or register
avatar
3
assemosman85 2015.04.15 16:13
 

Hello,

I have a buying criteria and a selling criteria

What I want is to close a buy order if:

1) Selling criteria occurred (Reversal)

or

2) If another Buy signal occurred after opening the first one. I want to close the first buy order and enter a new buy order.


And vice versa for the sell order.


When I put the same buy or sell criteria for closing the order in the script, Metatrader enters and close the order at the same price several times, all I want to do is to tell it to wait one bar after opening the position and check, and I don't know how to do that.

I really appreciate your help in this.

Thank you,

avatar
16
xiruko 2015.04.15 23:08 #
 

Try to put the code that closes the orders before the code that opens them. I assume that you check if there is a new bar before checking to open an order.

 Regards. 

avatar
Moderator
3423
GumRai 2015.04.16 00:45 #
 
assemosman:


2) If another Buy signal occurred after opening the first one. I want to close the first buy order and enter a new buy order.

Why gift the broker the spread everytime, when you can simply keep the trade open?
avatar
3
assemosman85 2015.04.17 19:41 #
 
GumRai:
Why gift the broker the spread everytime, when you can simply keep the trade open?

Sometimes when I open a buy order and the price goes down but doesn't reach the stop loss, and then back up again with a new buy entry with a different take profit that maybe like -2 points for the first entry.

The other solution is to modify the stoploss and take profit of the first order if a specific criteria occurs, which I don't know how to do also.

avatar
3
assemosman85 2015.04.17 19:42 #
 
xiruko:

Try to put the code that closes the orders before the code that opens them. I assume that you check if there is a new bar before checking to open an order.

 Regards. 

Thank you Xiruko, I will try that.
Back to topics list  

To add comments, please log in or register