// ...switch(type)
{
//--- purchase transactioncaseORDER_TYPE_BUY:
{
//--- check StopLoss
SL_check=(Bid-SL>stops_level*_Point);
if(!SL_check)
PrintFormat("For order %s StopLoss=%.5f must be less than %.5f"+
" (Bid=%.5f - SYMBOL_TRADE_STOPS_LEVEL=%d points)",
EnumToString(type),SL,Bid-stops_level*_Point,Bid,stops_level);
//--- check TakeProfit
TP_check=(TP-Ask>stops_level*_Point);
if(!TP_check)
PrintFormat("For order %s TakeProfit=%.5f must be greater than %.5f"+
" (Bid=%.5f + SYMBOL_TRADE_STOPS_LEVEL=%d points)",
EnumToString(type),TP,Bid+stops_level*_Point,Bid,stops_level);
//--- return the result of the checkreturn(SL_check&&TP_check);
}
//--- sale transactioncaseORDER_TYPE_SELL:
{
//--- check StopLoss
SL_check=(SL-Ask>stops_level*_Point);
if(!SL_check)
PrintFormat("For order %s StopLoss=%.5f must be greater than %.5f "+
" (Ask=%.5f + SYMBOL_TRADE_STOPS_LEVEL=%d points)",
EnumToString(type),SL,Ask+stops_level*_Point,Ask,stops_level);
//--- check TakeProfit
TP_check=(Bid-TP>stops_level*_Point);
if(!TP_check)
PrintFormat("For order %s TakeProfit=%.5f must be less than %.5f "+
" (Ask=%.5f - SYMBOL_TRADE_STOPS_LEVEL=%d points)",
EnumToString(type),TP,Ask-stops_level*_Point,Ask,stops_level);
//--- return the result of the checkreturn(TP_check&&SL_check);
}
break;
}
// ...
???
If we do as in the article we just lose points from the spread in profit! Maybe I don't understand something?
If we do as in the article we just lose points from the spread in profit! Maybe I don't understand something?
We lose profit, of course. But it is impossible to put stops closer:
Therefore, TakeProfit and StopLoss levels should be compared with the current price, at which it is possible to make an operation of the opposite direction:
Buy is made at Ask price - TakeProfit and StopLoss levels should be compared with the current selling price Bid.
Selling is made at the Bid price - TakeProfit and StopLoss levels should be compared with the current Ask price.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello, everyone.
What is the error so incomprehensible:
test on EURUSD,H1 strategy tester report not found
And how to fight it? What other report?
Hey, everybody.
What kind of error is this strange:
test on EURUSD,H1 strategy tester report not found
And how to fight it? What report?
Hi, maybe there is an infinite loop somewhere, so the test does not reach the moment of report generation.
I'm having a weird time today, it says it's been completed with errors, but it's not clear what they are. It's empty.
I'm having a weird time today, it says it's been completed with errors, but it's not clear what they are. It's empty.
I'm having a weird time today, it says it's been completed with errors, but it's not clear what they are. It's empty.
I think it's fixed.
It's definitely fixed, the robot's been tested.
Bid - StopLoss >= SYMBOL_TRADE_STOPS_LEVEL
StopLoss - Ask >= SYMBOL_TRADE_STOPS_LEVEL
That's what the article says. But, isn't that the way to do it?
Bid - StopLoss >= SYMBOL_TRADE_STOPS_LEVEL
Bid - TakeProfit >= SYMBOL_TRADE_STOPS_LEVEL
StopLoss - Ask >= SYMBOL_TRADE_STOPS_LEVEL
And also in the function code -
???
If we do as in the article we just lose points from the spread in profit! Maybe I don't understand something?
Bid - StopLoss >= SYMBOL_TRADE_STOPS_LEVEL
StopLoss - Ask >= SYMBOL_TRADE_STOPS_LEVEL
That's what the article says. But, isn't that the way to do it?
Bid - StopLoss >= SYMBOL_TRADE_STOPS_LEVEL
Bid - TakeProfit >= SYMBOL_TRADE_STOPS_LEVEL
StopLoss - Ask >= SYMBOL_TRADE_STOPS_LEVEL
And also in the function code -
???
If we do as in the article we just lose points from the spread in profit! Maybe I don't understand something?
We lose profit, of course. But it is impossible to put stops closer:
Therefore, TakeProfit and StopLoss levels should be compared with the current price, at which it is possible to make an operation of the opposite direction:
Published an article What checks a trading robot must pass before publishing in the Market:
Author: MetaQuotes Software Corp.
Half of the robots on the market are not working.
This is an article for those who write EAs. You need articles from the "How to Test" series.