
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
Good afternoon. I have generated an EA using mql5. I do not have any complaints about its work. I don't know how to change it for buying to sell or vice versa. I am not that familiar with mql4 but I'm not that familiar with mql5.
Please, advise me if you don't mind.
Good afternoon. I have generated an EA using mql5. I do not have any complaints about its work. I don't know how to change it for buying to sell or vice versa. I am not that familiar with mql4 but I'm not that familiar with mql5.
Please, advise me if you don't mind.
Maybe you need to specify what you generated the EA with (say, you can create it with a wizard), whether it uses the standard library and what is meant by "to sell instead of buy and vice versa".
Good afternoon. I have generated an EA using mql5. I do not have any complaints about its work. I don't know how to change it for buying to sell or vice versa. I am not that familiar with mql4 but I'm not that familiar with mql5.
Please, advise me if you don't mind.
There are two possibilities, either you should correct the signals class or the trade class (the part that deals with order execution).
But it is easier to change the signals class (less hassle).
But from MT4 experience reversal of bad signals gives nothing. The chart will be different, but it will still drain at the rate of spread.
There are two options, either to edit signals class or trade class (the place that deals with order execution).
But it is easier to change the signals class (less hassle).
But from MT4 experience I remember that reversing bad signals gives nothing. The chart will be different, but it will still drain at the rate of spread.
You need to change the order type in the trade request. There are a total of eight order types:
for market orders - ORDER_TYPE_BUY (buy) , ORDER_TYPE_SELL (sell) ;
for pending orders - ORDER_TYPE_BUY_LIMIT (buy), ORDER_TYPE_SELL_LIMIT (sell);
- ORDER_TYPE_BUY_STOP (buy), ORDER_TYPE_SELL_STOP (sell);
In order to switch from Buy to Sell, change the order type to the opposite, and don't forget to recalculate the stop levels.
There are two options, either to edit signals class or trade class (the place that deals with order execution).
But it is easier to change the signals class (less hassle).
Urain:
But from MT4 experience I remember that reversing bad signals gives nothing. The chart will be different, but all the same plum at the rate of spread.
I searched for them, there are none.
I searched for them, there are none.
This is if everything is written at a low level without OOP(standard library and own classes).
If an Expert Advisor with OOP is used, the standard library is usually used (for newbies generation by Wizard is relevant), then it is easier to do otherwise. Then you don't have to dive into the MQL5 wilderness.
Take the standard class (even the base one, so to speak) CExpert.
It has the following functionality for market entering
Market entry methods
virtual CheckOpen
Checks necessity and possibility of entering the market
virtual CheckOpenLong
Checks necessity and possibility of entering long position
virtual CheckOpenShort
Checks necessity and possibility of entering short position
virtual OpenLong
Executes operations for long position opening
virtual CheckOpenShort
Executes operation for short position opening
Just change call of OpenLong to OpenShort and the matter is done.
To the developers - I don't know about the MQL help file, but there is a bug in the OpenShort names!
Yes, there is, in trade class, but it's better to change it in signals class, then the correct logic is preserved and there is less to correct, you change only output signal to the opposite one and that's all.
If the signal class is taken from the standard library (it cannot be changed), it won't work. And it is always more convenient to change "your" code, especially for an Expert Advisor.
At least in my opinion. But again, I don't see the point in it.
This is if everything is written at a low level without OOP(standard library and custom classes).
If expert with OOP applied...