Estou testando um EA da biblioteca e ele não está abrindo ordens pois está dando o erro de inválid volume. Ao código eu tentei acrescentar uma
parte que talvez pudesse checar o voluem correto mas não adiantou. Como posso resolver isso ?
SellPositionOpen(SELL_Open,Symbol(),DnSignalTime,MM,LOT,Deviation_,StopLoss_,TakeProfit_);
//----
}
//+------------------------------------------------------------------+//| Check the correctness of the position volume |//+------------------------------------------------------------------+bool CheckVolumeValue(double volume,string &error_description)
{
//--- minimal allowed volume for trade operationsdouble min_volume=m_symbol.LotsMin();
if(volume<min_volume)
{
error_description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume);
return(false);
}
//--- maximal allowed volume of trade operationsdouble max_volume=m_symbol.LotsMax();
if(volume>max_volume)
{
error_description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume);
return(false);
}
//--- get minimal step of volume changingdouble volume_step=m_symbol.LotsStep();
int ratio=(int)MathRound(volume/volume_step);
if(MathAbs(ratio*volume_step-volume)>0.0000001)
{
error_description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f",
volume_step,ratio*volume_step);
return(false);
}
error_description="Correct volume value";
return(true);
}
Para login e uso do site MQL5.com, você deve ativar o uso de cookies.
Ative esta opção no seu navegador, caso contrário você não poderá fazer login.
Você entrou na conta. A autenticação de dois fatores foi desativada. Configure-a novamente e escaneie um novo código QR ou continue com a autenticação de dois fatores desativada.
Estou testando um EA da biblioteca e ele não está abrindo ordens pois está dando o erro de inválid volume. Ao código eu tentei acrescentar uma parte que talvez pudesse checar o voluem correto mas não adiantou. Como posso resolver isso ?