Errors, bugs, questions - page 375

 
Interesting:

What's there to think about? This one involves a ROTURN and a RETURN. As for the ROTURN, it is simpler; according to the netting logic in MT5 it is closing a position at profit or stop, followed by opening the opposite position at the difference in volumes.

As for MT4, the rollover is usually implemented through a lock.

No, you misunderstand. I meant copying of opposite trades. In other words, on MT5 the EA is buying and on MT4 it is copying the sale.

And the strategy is not meant for reversal but for simple TP taking. It just seems to me that if we hold until the position opens in the other direction we are better off... It's better to lose.

 
Dimmish:

No, you misunderstand. I meant copying back trades. That is, on MT5 the EA is buying and on MT4 it is copying the sale.

And the strategy is not meant for reversal, but for simple TP taking. It just seems to me that if we hold until the position opens in the other direction we are better off... It is better to lose.

1.

If I tried to copy from MT4 to MT4, it would probably be possible to do it.

But MT4 in this situation should live by MT5 laws (although not obliged, of course).

2.

The reversal in MT5 (because of the peculiarities of netting) is so difficult that you should think about using it all the time.

Sometimes it's better to put in a CU and re-enter lower/higher...

 

Is there a problem with the website?


 
Interesting:

1.

In principle, it is probably possible to implement this, since MT4 is copied from MT4 to MT4.

But MT4 should live by the laws of MT5 (although not obliged of course).

2.

The reversal in MT5 (because of the peculiarities of netting) is so complicated, that it is worth thinking about using it permanently.

Sometimes it's better to put in BU and re-enter below/above...

1. Here copying from MT5 to MT4https://www.mql5.com/ru/articles/189. I will try to do it tomorrow, maybe it will work.

2. I should think how to make it better. Maybe re-enter, maybe something else.

AlexSTAL:

Is there a problem with the website?



What kind of problem?

Копирование торговли из MetaTrader 5 в MetaTrader 4
Копирование торговли из MetaTrader 5 в MetaTrader 4
  • 2010.10.29
  • Nikolay Demko
  • www.mql5.com
Можно ли в MetaTrader 5 торговать на реале уже сегодня? Как организовать такую торговлю? Приводится теория этих вопросов и рабочие коды, при помощи которых реализуется копирование сделок из терминала MetaTrader 5 в MetaTrader 4. Статья будет полезна как разработчикам советников, так и практикующим трейдерам.
 
Dimmish 2011.04.25 10:35 2011.04.25 10:35:06 2011.04.25 10:35| 213.138.86.27

Good afternoon. I have generated an EA using mql5. I do not have any complaints about its work. I don't know how to modify it, I just don't know how to change it so it would sell instead of buy and 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.

Gentlemen, you do not have to "fix" the class. We need to inherit it.

It goes like this:

//+------------------------------------------------------------------+
//| Global expert object                                             |
//+------------------------------------------------------------------+
class CMyExpert : public CExpert
  {
protected:
   //--- trade open positions processing
   virtual bool      OpenLong(double price,double sl,double tp)   { price=0.0; sl=0.0; tp=0.0; return(CExpert::OpenShort(price,sl,tp)); }
   virtual bool      OpenShort(double price,double sl,double tp)  { price=0.0; sl=0.0; tp=0.0; return(CExpert::OpenLong(price,sl,tp));  }
  };
CMyExpert ExtExpert;

price=0.0; // at the current price

sl=0.0; // without stop

tp=0.0; // without takei

 
uncleVic:

Gentlemen, you don't have to "fix" the class. We need to inherit.

Something like this:

price=0.0; // at the current price

sl=0.0; // without a stop

tp=0.0; // without take profit


Thank you. It reverses the trades. Only it doesn't make the sale. There is a buy but no sale.

I looked into sl and tp. If you write:

virtual bool      OpenLong(double price,double sl,double tp)   { price=0.0; sl=0.0; tp=0.0; return(CExpert::OpenShort(price,sl,tp)); }
virtual bool      OpenShort(double price,double sl,double tp)  { price=0.0; sl=100.0; tp=0.0; return(CExpert::OpenLong(price,sl,tp));  }

Then the Expert Advisor only sells. And if you write it like this:

virtual bool      OpenLong(double price,double sl,double tp)   { price=0.0; sl=100.0; tp=0.0; return(CExpert::OpenShort(price,sl,tp)); }
virtual bool      OpenShort(double price,double sl,double tp)  { price=0.0; sl=0.0; tp=0.0; return(CExpert::OpenLong(price,sl,tp));  }

Then it only buys.

IfGlobal expert object is inserted into Expert Advisor built on MA, then everything reverses well, trades are opened in both directions.

 
AlexSTAL:

Is there a problem with the site?

I noticed yesterday that the counter was reset, and today I wanted to write back as a request...
 
Dimmish:

Thank you. The deals are flipping. Only there is no sale. There is a purchase but no sale.

I looked into sl and tp. If you write:

Then the Expert Advisor only sells. And if you write it like this:

Then it only buys.

IfGlobal expert object is inserted into Expert Advisor built on MA, all is well reversed, trades are opened in both directions.

Not the number of points.

double stop_level=100.0;  // уровень стопа в 4-хзнаковых пунктах
//--- для покупки
sl=m_symbol.NormalizePrice(m_symbol.Ask()-stop_level*m_adjusted_point);
//--- для продажи
sl=m_symbol.NormalizePrice(m_symbol.Bid()+stop_level*m_adjusted_point);
 
uncleVic:

sl not the number of points.

Well, I changed it just for the sake of interest.

If you enter it indouble stop_level=100.0; then it opens both to sell and to buy. But if we open a Buy position, it cannot sell. It can only buy, close the previous buy and buy again. He may also sell only when the buy position is closed by SL. The same situation is with buying after selling.

 

Dimmish:

Ifdouble stop_level=100.0; is entered, it opens both a sell and a buy position. However, if a buy position is opened, it cannot sell. It can only buy, close the previous buy and buy again. And he may sell only when the buy position is closed by SL. The same situation is with buying after selling.

Netting rules. That is why I hinted that there is no point in checking using MT4.
Reason: