expert advisor - miscellaneous questions - page 2

 

#Lot - Closed

I solved that issue like below.

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

anyway thanks @Keith

 

#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.

 

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.

 
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! 

 

#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!

 
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);
 
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.
 
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

 
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.

 
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

 

Reason: