Discussion of article "The checks a trading robot must pass before publication in the Market" - page 4

 

Very good!

 

During automatic testing of the Expert Advisor, an emergency termination occurred and the message Order Send Error #131: ERR_INVALID_TRADE_VOLUME was received. In the section "How to quickly catch and fix errors in a trading robot" the solution of the problem is given in mql5. But my Expert Advisor is written in mql4. How can I do it for him? How should the Expert Advisor behave to pass the volume correctness check?

 
Sergey Vrady:

During automatic testing of the Expert Advisor, an emergency termination occurred and the message Order Send Error #131: ERR_INVALID_TRADE_VOLUME was received. In the section "How to quickly catch and fix errors in a trading robot" the solution of the problem is given in mql5. But my Expert Advisor is written in mql4. How can I do it for him? How should the Expert Advisor behave to pass the volume correctness check?


mql5 and mql4languages are almost identical, the only difference is in the names of functions,

attach the code of your volume calculation and they will help you to translate it to mql4.

 

Maybe instead of this:

//--- check if there are changes in Takeprofit level
bool TakeProfitChanged=(MathAbs(OrderTakeProfit()-sl)>tp);

this is the way to do it:

//--- check if there are changes in Takeprofit level
bool TakeProfitChanged=(MathAbs(OrderTakeProfit()-tp)>point);

I think that's better.

 
Almaz Allaberenov:

Maybe instead of this:

this is the way to do it:

I think that would be better.

Copypaste, we'll fix it, thanks.

 

Hello.

Thank you very much for the article!

Maybe I have misunderstood something, but I think there is an inaccuracy in checking freeze_level and stops_level.

According to the test the distance should be "not less than" level and in the tables also >= , everything fits. But in the code it is just >

For example

TakeProfit - Bid >= SYMBOL_TRADE_STOPS_LEVEL
TP_check=(TP-Bid>stops_level*_Point);

So what is the correct way, >= or > ?

 
Oleksii Chepurnyi:

According to the test the distance should be "not less than" level and in the tables also >= , everything fits. But in the code it is just >

For example

So is it correct, >= or > ?

For reliability, it is better to require a stricter condition.
 
Rashid Umarov:
For reliability, it is better to require a more stringent condition.

Well, it can be organised in the Expert Advisor before the trade operation.

Is it more correct to use >= in the check function itself? Or can there be some problems?

 
Oleksii Chepurnyi:

Well, it can be organised in the Expert Advisor before the trade operation.

But in the check function itself >= is it more correct? Or can there be some problems?

Sometimes there are problems with wrong stops. I usually check for "greater than stoplevel+1 point", then there are no errors with wrong stops.
 
Artyom Trishkin:
Sometimes there are problems with wrong stops. I usually check for "more stoplevel+1 point", then there are no errors with wrong stops.
But then there is a chance to miss a trade....
This website uses cookies. Learn more about our Cookies Policy.