[HELP - Resolved] - Invalid Volume

 

Hi all.

is there something wrong in this code? It was passing automatic validation before, but now it is not.

Nothing else was changed, if I recall correctly.

            request.volume=round(request.volume/SymbolInfoDouble(par_temp,SYMBOL_VOLUME_MIN))*SymbolInfoDouble(par_temp,SYMBOL_VOLUME_MIN);
            if(request.volume<SymbolInfoDouble(par_temp,SYMBOL_VOLUME_MIN)) request.volume=SymbolInfoDouble(par_temp,SYMBOL_VOLUME_MIN);
            if(CheckMoneyForTrade(par_temp,request.volume,ORDER_TYPE_BUY)) OrderSend(request,result);

First line will round take volume 0.123456 for example and make it 12.3456, rount it to 12, then make it 0.12

I made this because normalizedouble to 2 digits didn't seem to work for some symbols with min volume 0.25 and stuff like that. Maybe I used it wrong when I did, in the past.

Second line, if volume is lower than volume minimum, it sets volume to minimum.

Third line checks and sends order.

Volumes are "double". Should I change them to float?


Outcome does not validate.


I am forcing the use of XAU regardless of the symbol, since this is meant to trade gold only.

But I don't think this is the issue since it validated the previous versions the same way.

Thanks in advance for your help

 
Should I use Step instead of minimum on first line?
 

Passed validation now.

The correct method is the use of volume STEP not volume MIN.

Picked up the idea from a previous post of Mr. Roeder

Thanks