Erro order_send failed

 

Hi, Guys!

I have the following error:


1. order_send(): by WINZ22 0.1 lots at 109430.0 with deviation=200 points

2. order_send failed, retcode=10014


can anybody help me? Thanks

 
Gabriel Fratucci: I have the following error: 1. order_send(): by WINZ22 0.1 lots at 109430.0 with deviation=200 points. 2. order_send failed, retcode=10014. can anybody help me? Thanks

That would be an invalid volume error.

10014

TRADE_RETCODE_INVALID_VOLUME

Invalid volume in the request

What are the contract specifications for that symbol regarding volume?

Is you code checking them?

SYMBOL_VOLUME_MIN

Minimal volume for a deal

double

SYMBOL_VOLUME_MAX

Maximal volume for a deal

double

SYMBOL_VOLUME_STEP

Minimal volume change step for deal execution

double

SYMBOL_VOLUME_LIMIT

Maximum allowed aggregate volume of an open position and pending orders in one direction (buy or sell) for the symbol. For example, with the limitation of 5 lots, you can have an open buy position with the volume of 5 lots and place a pending order Sell Limit with the volume of 5 lots. But in this case you cannot place a Buy Limit pending order (since the total volume in one direction will exceed the limitation) or place Sell Limit with the volume more than 5 lots.

double

 
Gabriel Fratucci:

Hi, Guys!

I have the following error:


1. order_send(): by WINZ22 0.1 lots at 109430.0 with deviation=200 points

2. order_send failed, retcode=10014


can anybody help me? Thanks


use my function below, to Validade the LOT Size and Step. It verifies the LOT Size and Step, according to Symbol Specifications, the and rounds it to the correct Volume and Step 


CSymbolInfo             ativo;


//Rounds and ajust the LOT and STEP as defined on its specifications

double ArredondaLoteComStep(double lote)
{

    double lote_arredondado = 0;
    double lot_step   =  ativo.LotsStep();
    double lot_max    =  ativo.LotsMax();
    double lot_min    =  ativo.LotsMin();


    if (lote > lot_max) lote = lot_max;     
    if (lote < lot_min) lote = lot_min;     

// Round it according to its specifications.
//
    lote_arredondado =  ( MathFloor( (lote + (0.5 * lot_step)) / lot_step ) * lot_step );


    if (lote_arredondado > lot_max) lote_arredondado = lot_max;     
    if (lote_arredondado < lot_min) lote_arredondado = lot_min;     


    lote_arredondado = NormalizeDouble(lote_arredondado, 2);

    return(lote_arredondado);

}
Reason: