Getting Invalid Price error in Validation

 

Hi, Im getting Invalid Price error in Validation to publish my EA.

Looking at this it looks like it's not getting the price.

My code regarding the order is below.

In fact, it is working normally in backtests and real trades.

Pls, somebody help me.

request.action = TRADE_ACTION_DEAL;
request.price = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
request.sl = ask_stpls;
request.tp = ask_tkprft;
request.symbol = _Symbol;
request.volume = Lot;
request.magic = EA_Magic;
request.type = ORDER_TYPE_BUY;
request.type_filling = ORDER_FILLING_FOK;
request.deviation=5;

bool sent = OrderSend(request,result);
 

Please search before you post!

Articles

The checks a trading robot must pass before publication in the Market

MetaQuotes, 2016.08.01 09:30

Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.

Forum on trading, automated trading systems and testing trading strategies

Tick size vs Point(), can be a little tricky in Multicurrency EA

Fernando Carreiro, 2022.03.09 12:11

Tick Size and Point Size can be very different especially on stocks and other symbols besides forex.

Always use Tick Size to adjust and align your prices, not the point size. In essence, make sure that your price quotes, are properly aligned to the Tick size (see following examples).

...
double tickSize = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE );
...
double normalised_price = round( price / tick_size ) * tick_size;
...
// Or use a function
double Round2Ticksize( double price )
{
   double tick_size = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE );
   return( round( price / tick_size ) * tick_size );
};
 
Fernando Carreiro #:

Please search before you post!

thank you fernando.
of course, I read them.

but, I don't understand why my order price is zero.

and, my understand is...I don't need to put request.price in case by TRADE_ACTION_DEAL

 
Fernando Carreiro #:

Please search before you post!

how do you think is this?
my EA is working at back test.
 
Atsushi 澁Ki #: but, I don't understand why my order price is zero.

We are unable to see your full code, so we are unable to answer that.

Atsushi 澁Ki #: and, my understand is...I don't need to put request.price in case by TRADE_ACTION_DEAL

For the "Instant Execution Policy", you always have to provide the price, as well as deviation if you want to control your re-quotes.

And remember that a Buy order opens at the Ask price, and a Sell order opens at the Bid price.

 
Atsushi 澁Ki #: how do you think is this? my EA is working at back test.

Just because your EA works in your environment, does not mean that it will pass the quality control of the validation process.

The validation process needs to make sure your EA will function correctly in other environments and with different contract specifications.

The users that will buy the product will certainly not have the same conditions as you.

 
Fernando Carreiro #:

We are unable to see your full code, so we are unable to answer that.

For the "Instant Execution Policy", you always have to provide the price, as well as deviation if you want to control your re-quotes.

And remember that a Buy order opens at the Ask price, and a Sell order opens at the Bid price.

Please, don't think only my poor knowledge fault easily.


This is an example of the part that executes a buy market order.

request.action = TRADE_ACTION_DEAL;
request.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
request.sl = ask_stpls;
request.tp = ask_tkprft;
request.symbol = _Symbol;
request.volume = Lot;
request.magic = EA_Magic;
request.type = ORDER_TYPE_BUY;
request.type_filling = ORDER_FILLING_FOK;
request.deviation=50;
//--- send order
bool sent = OrderSend(mrequest,mresult);

Pls, look at 2nd line.

I can't get the Ask price from this function.

request.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK);

Should I think this is a problem with other parts of my code?

look at error messages again.

I can't find any information to fix this problem in  The checks a trading robot must pass before publication in the Market

I tried to setting this to BID instead of ASK.(by BUY order)

request.price = SymbolInfoDouble(_Symbol,SYMBOL_BID);

So, Of course no transaction will take place.

I can understand about this result.I know.

However, the error message clearly changed.

just only one.

An error has occurred due to specifying the BID price in the buy order.

From this, it can be inferred that the BID price has been obtained.

"SymbolInfoDouble(Symbol(), SYMBOL_BID) " is looks working.

so, Why does  "SymbolInfoDouble(Symbol(), SYMBOL_ASK) " become zero? 

Can't this be considered a bug in the validator?

I just want help....

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 

I could solved it.

Thank you Fernando.