Download MetaTrader 5

expert advisor - miscellaneous questions - page 2

To add comments, please log in or register
Max Enrik
861
Max Enrik  

#Lot - Closed

I solved that issue like below.

ObjectSetString( 0, _edtLot, OBJPROP_TEXT, "Lot: " + DoubleToString( _lot, 2 ) );

anyway thanks @Keith

Max Enrik
861
Max Enrik  

#Order Mistakes - Open

 

While internet 'Disconnection' period of time I clicked several times 'Buy and Sell' Order buttons, and nothing was happened, so after few minutes internet 'Reconnected' - all Orders opened (which one I need to open Orders while disconnection period of time - P.S almost Orders quantity over 15.)

So I absolutely have not any idea how it was happened, that problem where comes from, please let me know something about that, I need to prevent that type of distasteful situations.

 

Thanks in advance.

whroeder1
14785
whroeder1  

You clicked, order was sent, lost connection. You then clicked some more queuing them, before either OrderSend returned with 128, or reconnection and valid OrderSend returned. You ignored the error, and processed more clicks.

Ignore clicks while OrderSend is in progress.

Max Enrik
861
Max Enrik  
whroeder1:

You clicked, order was sent, lost connection. You then clicked some more queuing them, before either OrderSend returned with 128, or reconnection and valid OrderSend returned. You ignored the error, and processed more clicks.

Ignore clicks while OrderSend is in progress.

Much more thanks for quickly response.

I understand like this:

  • I could write code for 'Ignore clicks while OrderSend is in progress.'
  • I could write code for Errors.
Is that right?

After your answer I will research about that.

All the best! 

Max Enrik
861
Max Enrik  

#Lot 0 (zero) - Open

 

I try to 'Lot' size could not be 0 (zero).

I need help, please.

double _lotSize = 0.10 ; // Lot Size
double _lotStep = 0.01 ; // Lot Step
//-------Lot Minus--------------------------------------------------------------|
if ( sparam == _btnLotMinus )
{
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_STATE, false );
    _lotSize -= _lotStep;
    if ( _lotSize <= 0 )
    {
        _lotSize = _lotStep;
    }

    _calcUpdade( CALC_CHANGE_LOT );

    Print( " | DoubleToStr /   ", DoubleToStr( _lotSize, 2 ) );
}   //---if Close


Thanks!

honest_knave
Moderator
2433
honest_knave  
Max Enrik:

#Lot 0 (zero) - Open


I try to 'Lot' size could not be 0 (zero).

I need help, please.

double _lotSize = 0.10 ; // Lot Size
double _lotStep = 0.01 ; // Lot Step


Thanks!

NB: I haven't read the whole thread

Why are you manually setting a value for lotstep? That is determined by the broker (and may well be more than 0.01)

double _lotStep = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
Max Enrik
861
Max Enrik  
honest_knave:

Why are you manually setting a value for lotstep? That is determined by the broker (and may well be more than 0.01)

Oh! Nice man, thanks I'd put it in my EA's soon.
honest_knave
Moderator
2433
honest_knave  
Max Enrik:
Oh! Nice man, thanks I'd put it in my EA's soon.

You need to be checking maxlot, minlot and lotstep.

HTH

Max Enrik
861
Max Enrik  
honest_knave:

You need to be checking maxlot, minlot and lotstep.

HTH

Yeah!

That helps a lot. I don't mind about max and min lots. I started researching about that. (and I found something just in a few minutes.)

Big thanks.

Max Enrik
861
Max Enrik  
I am using NormalizeDouble for my EA's. But I worry about 'NormalizeDouble' message, but I see lot size on chart like this: 0.07

So, I need good advice, please.

02:00:00.069 - custom expert EURUSD,H1: | _lotSize - NormalizeDouble: 0.07000000000000001
02:00:00.069 - custom expert EURUSD,H1: | _lotSize - DoubleToString : 0.07

 

123456789...39
To add comments, please log in or register