Download MetaTrader 5

Error Message on EA Run

To add comments, please log in or register
Stark
656
Stark  

Dear all

 

I am running an EA on a Strategy tester on MT4 and it runs okay but it doesn't executes any trades.

 

I get an error message like this below:

 

2015.06.04 22:55:31.858 1993.09.21 23:00  Stark_EA_prototype AUDUSD,M30: OrderSend error 131

2015.06.04 22:55:28.017 1993.09.14 23:00  Stark_EA_prototype AUDUSD,M30: Alert: Ordersend failed with error: 131

2015.06.04 22:55:28.017 1993.09.14 23:00  Stark_EA_prototype AUDUSD,M30: OrderSend error 131

2015.06.04 22:55:27.967 Stark_EA_prototype inputs: passwordInp=61305968; trailingStopPipsInp=20; stopLossPipsInp=50; movingAveragePeriod=13; movingAverageShift=0; movingAverageMethod=1; movingAverageAppliedPrice=0; maxAllowedSlippageInp=10; startTradingHour=0; endTradingHour=24; riskPercent=10; leverageMultiplier=5; initialHighInput=0; initialLowInput=0; movingAverageGradient=15; usedStrategy=1; reverseOnStop=1; backTestingGradient=1; 

2015.06.04 22:55:27.798 TestGenerator: current spread 29 used


Any ideas as why this may be happening?

 

Much appreciated in advance.

Cheers

Stark

Drazen Penic
2616
Drazen Penic  
ERR_INVALID_TRADE_VOLUME                    131

 

 Check your lot size. 

Stark
656
Stark  

Thanks a lot Penic. I will have a look again at the trade volume calculation.

 

Any ideas on a function so that only 10% of available balance is traded on any one position would be welcomed? 


Regards 

Stark 

Drazen Penic
2616
Drazen Penic  

Search through the Codebase for "money management" or "risk calculation".

You will find number of complete source code examples. 

Osama Shaban
1500
Osama Shaban  

Try to normalize the lot size before using it in the OrderSend() function to something like this ...

double lot = NormalizeDouble(Lots, LotDigits);

 Where LotDigits represents the number of digits in the lot representation after the decimal point. It is normally equal to 2 or 1 in some cases and rarely 3.

Stark
656
Stark  

Thanks all for you kind and helpful feedback.

Problem is now resolved,

Stark

To add comments, please log in or register