EA BUY/SELL reversal

To add comments, please log in or register
Dale Forsyth
72
Dale Forsyth  

Hi all,


Is there any simple way that i am able to reverse the Buy/Sell orders that are executed by an Expert Advisor? I am new to both trading and coding though I am able to understand things reasonably well.


Any help with this would be greatly appreciated.


Thank you.


Dale.

Marco vd Heijden
Moderator
8445
Marco vd Heijden  

yes change OP_BUY to OP_SELL and vice versa and also swap TP and SL and ASK and BID.

Fernando Carreiro
4798
Fernando Carreiro  
Dale Forsyth: Is there any simple way that i am able to reverse the Buy/Sell orders that are executed by an Expert Advisor? I am new to both trading and coding though I am able to understand things reasonably well. Any help with this would be greatly appreciated.

If you have the source code, then you can change the instructions to reverse the strategy; otherwise no! You will however, need to learn more about coding and trading.

EDIT: Just changing order types and stops, will not be sufficient. There are usually other factors involved!

Marco vd Heijden
Moderator
8445
Marco vd Heijden  

Of course it will be enough to

Dale Forsyth:

reverse the Buy/Sell orders that are executed by an Expert Advisor

Unless hes talking about MQL5 because he didn't specify.
Fernando Carreiro
4798
Fernando Carreiro  
Marco vd Heijden: Of course it will be enough to ... Unless hes talking about MQL5 because he didn't specify.

No it is not enough, irrespective of it being MQL4 or MQL5! There are other factors to consider:

  • Just exchanging the S/L and T/P will affect the R:R.
  • Maybe the S/L is based on an indicator (such as a MA or a PSAR). You cant just reverse those conditions!
  • Maybe there are trailing-stops to consider.
  • Maybe .... (the list can be quite large).

In conclusion, I repeat: Just changing order types and stops, will not be sufficient. There are usually other factors involved!

Marco vd Heijden
Moderator
8445
Marco vd Heijden  

And i repeat

Marco vd Heijden:

Of course it will be enough to

Dale Forsyth:

 to reverse the Buy/Sell orders that are executed by an Expert Advisor

Fernando Carreiro
4798
Fernando Carreiro  
Marco vd Heijden: And i repeat
Oh I see. So if one keeps repeating "banana, banana, banana", then it will no longer be an "apple" anymore! I wonder where I have heard that before????
Marco vd Heijden
Moderator
8445
Marco vd Heijden  

We do not have code examples here so there is very little to discuss.

Assuming we are talking about the syntax in it's most simplest form, the expert will open opposing orders when these variables are swapped.

What other things the expert handles is another case, but the orders will be reversed, and it has got nothing to do with bananas.

To add comments, please log in or register