BuyStop gives invalid filling type error

 

Hi,

I am sending with an EA a BuyStop order, when testing, it gives always the error

CTrade::OrderOpen:Invalid Filling Type

Code is (utrade is created fom CTrade of course):


void U_Go_BuyStop()
{
Get_Values();
D_Ask=G_Ask+D_StopRange;
uexp=TimeCurrent()+max_pending;

utrade.SetTypeFilling(ORDER_FILLING_RETURN);
utrade.SetDeviationInPoints(5);

//utrade.BuyStop(lot_size,NormalizeDouble(D_Ask,G_Digits),USym,NormalizeDouble(D_Ask-DO_SL,G_Digits),NormalizeDouble(D_Ask+DO_TP,G_Digits),ORDER_TIME_GTC,uexp,VVersion);
utrade.BuyStop(lot_size,NormalizeDouble(D_Ask,G_Digits),USym,NormalizeDouble(D_Ask-DO_SL,G_Digits),NormalizeDouble(D_Ask+DO_TP,G_Digits));
utrade.PrintRequest(); 
utrade.PrintResult();  


}//end U_Go_BuyStop()

I also tried all other Filling Types:

ORDER_FILLING_FOK and

ORDER_FILLING_IOC

None of them works. I tried various Symbols as well. The broker allows "Filling: All".

Any idea? Is it maybe only a problem of the Tester? (it is weekend, cannot try on demo account).

When I use "Buy" instead of BuyStop (of course with slightly different parameters), then it works.

For the sake of completion (is not relevant for the problem):


//+------------------------------------------------------------------+
void Get_Values(){
G_Digits=symbol_info.Digits();
G_Ask=NormalizeDouble(symbol_info.Ask(),G_Digits);
G_Bid=NormalizeDouble(symbol_info.Bid(),G_Digits);
}

//--------------end Get_Values---------------------------------------------------------------------------------------------
 

claudio_arrau2:

...

See this topic.
 

Thanks a lot, the file in the other post corrected the problem.

I just hope that it will be part of the official distribution of MQL5!

 
claudio_arrau2:

Thanks a lot, the file in the other post corrected the problem.

I just hope that it will be part of the official distribution of MQL5!

We have to check this on next update.