Errors, bugs, questions - page 373

 

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.

Мастер MQL5: Создание эксперта без программирования
Мастер MQL5: Создание эксперта без программирования
  • 2010.12.15
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы хотите быстро проверить торговую идею, не тратя времени на программирование? Выберите в "Мастере MQL5" нужный тип торговых сигналов, подключите модули сопровождения позиций и управления капиталом - на этом вся работа закончена. Создайте свои реализации модулей или закажите их через сервис "Работа" - и комбинируйте новые модули с уже существующими.
 
Dimmish:

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.

Perhaps, you need to specify with what you have generated the EA (for example, you can create it with a wizard), whether the standard library is used there and what is meant by "to sell instead of buy and vice versa".
 
Interesting:
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".
Yes, by a wizard. As described herehttps://www.mql5.com/ru/articles/171. Well, I want it to give a signal to buy and vice versa.
Мастер MQL5: Создание эксперта без программирования
Мастер MQL5: Создание эксперта без программирования
  • 2010.12.15
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы хотите быстро проверить торговую идею, не тратя времени на программирование? Выберите в "Мастере MQL5" нужный тип торговых сигналов, подключите модули сопровождения позиций и управления капиталом - на этом вся работа закончена. Создайте свои реализации модулей или закажите их через сервис "Работа" - и комбинируйте новые модули с уже существующими.
 
Dimmish:

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.

 
Urain:

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.

I agree that the rollover will drain at the rate of spread. But this drain will be if even without a rollover, it will drain at the speed of the spread.
 
papaklass:

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.

I've looked for them, there aren't any.
 
Urain:

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).

I don't agree here, if all is well written in the Expert Advisor even "trade class" may not need to be corrected. Just call buy function instead of sell function in required place (having specified required parameters of call).

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 fully support this point. If the strategy is a slippery one, the resulting loss will be guaranteed (the only question is the timing).
Документация по MQL5: Основы языка / Функции / Вызов функции
Документация по MQL5: Основы языка / Функции / Вызов функции
  • www.mql5.com
Основы языка / Функции / Вызов функции - Документация по MQL5
 
Dimmish:
I searched for them, there are none.
There is, in the trading class, but it's better to change in the signals class, then the correct logic is preserved and there is less editing, you only change the output signal to the opposite one and that's it.
 
Dimmish:
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!

Urain:
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.

 
Interesting:

This is if everything is written at a low level without OOP(standard library and custom classes).

If expert with OOP applied...


In his initial post, Dimmish wrote that he generated an EA, which means that the EA is written using standard classes.
Reason: