Download MetaTrader 5
To add comments, please log in or register
Add our Facebook page to friends. Follow the latest news!
Brian
498
Brian 2016.11.30 14:07 

Hello, 

I was wondering if anyone can shed light on the following error:

 

Would appreciate suggestions on how to fix it.

There is plenty of margin available and the lot size I used is  0.03 

Much appreciated,

Thanks,

honest_knave
Moderator
1861
honest_knave 2016.11.30 14:09  
Brian:

Hello, 

I was wondering if anyone can shed light on the following error:

 

Would appreciate suggestions on how to fix it.

There is plenty of margin available and the lot size I used is  0.03 

Much appreciated,

Thanks,

You'll need to show your code, or at least the relevant parts.
Brian
498
Brian 2016.11.30 14:35  
honest_knave:
You'll need to show your code, or at least the relevant parts.

Hi Honest_Knave

I'm not sure what the relevant parts are and the EA is rather long.

Can I perhaps  message you and attach the EA or would you rather I try paste some of the code here?

Just to add to my earlier message. Despite the error, the EA does fill the order later but it's normally a good 10 to 30 minutes later and obviously at the wrong price 

Regards,

Alain Verleyen
Moderator
30243
Alain Verleyen 2016.11.30 14:57  
Brian:

Hello, 

I was wondering if anyone can shed light on the following error:

 

Would appreciate suggestions on how to fix it.

There is plenty of margin available and the lot size I used is  0.03 

Much appreciated,

Thanks,

You have either to use OrderLots() to close a full position or

to normalize your lot size this way :

      double lotStep=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
      lots=MathRound(lots/lotStep)*lotStep;
Keith Watford
Moderator
9504
Keith Watford 2016.11.30 22:57  
Alain Verleyen:

You have either to use OrderLots() to close a full position or

to normalize your lot size this way :

      double lotStep=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
      lots=MathRound(lots/lotStep)*lotStep;

Perhaps add the check

    double lotStep=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
    lots=MathRound(lots/lotStep)*lotStep;

    if(lots>OrderLots())
       lots=OrderLots();
.
Brian
498
Brian 2016.12.01 05:43  

Thank you all for your contributions.

Greatly appreciated

/
To add comments, please log in or register