Download MetaTrader 5
To add comments, please log in or register
Have you made a screenshot in MetaTrader? Share it with friends!
Claudio Arrau
104
Claudio Arrau 2013.07.20 21:27 

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---------------------------------------------------------------------------------------------
Alain Verleyen
Moderator
30295
Alain Verleyen 2013.07.20 22:17  

claudio_arrau2:

...

See this topic.
Claudio Arrau
104
Claudio Arrau 2013.07.21 14:32  

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!

Alain Verleyen
Moderator
30295
Alain Verleyen 2013.07.21 15:19  
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.
/
To add comments, please log in or register