Download MetaTrader 5
To add comments, please log in or register
Order a robot or an indicator for MetaTrader. The Freelance service will help you!
Bogdan Alin Baltatu
2919
Bogdan Alin Baltatu 2011.10.11 00:43 

I have a strage problem.I call a code from an script and works fine and if i call from am EA i have 'stack overflow' error.

What causes this problem?


//Later

I recive stack overflow error on OrderSend function.

Documentation on MQL5: Trade Functions / OrderSend
  • www.mql5.com
Trade Functions / OrderSend - Documentation on MQL5
Slawa
Moderator
6798
Slawa 2011.10.11 10:03  

Recursive calls?

Bogdan Alin Baltatu
2919
Bogdan Alin Baltatu 2011.10.11 11:38  
Yes, i call OrderSend function for eatch positions.
Documentation on MQL5: Trade Functions / OrderSend
  • www.mql5.com
Trade Functions / OrderSend - Documentation on MQL5
Rashid Umarov
Admin
11709
Rashid Umarov 2011.10.11 19:14  
dudufx:

Yes, i call OrderSend function for eatch positions.
You can see sample of a recursive call here - https://www.mql5.com/en/docs/common/GetTickCount
Documentation on MQL5: Common Functions / GetTickCount
  • www.mql5.com
Common Functions / GetTickCount - Documentation on MQL5
Bogdan Caramalac
1103
Bogdan Caramalac 2011.10.11 21:39  
No Rosh, my pal got it wrong, the function with OrderSend is NOT recursive. I can't tell why it generates the stack overflow. If it moves the function block inside the caller, there is no error anymore.
Rashid Umarov
Admin
11709
Rashid Umarov 2011.10.11 22:48  
Yo had better to write to Servicedesk with source code.
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
Slawa
Moderator
6798
Slawa 2011.10.12 10:40  
TheEconomist:
No Rosh, my pal got it wrong, the function with OrderSend is NOT recursive. I can't tell why it generates the stack overflow. If it moves the function block inside the caller, there is no error anymore.

pure recursive call

void CTrade::OrderSend(MqlTradeRequest &request,MqlTradeResult &results)
{
   OrderSend(request,results);
}

right call

void CTrade::OrderSend(MqlTradeRequest &request,MqlTradeResult &results)
{
   ::OrderSend(request,results);
}

See scope resolution operation 

/
To add comments, please log in or register