Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network. Millions of traders are waiting for this!
Luciano Ola
996
Luciano Ola 2014.04.02 00:28 

During my demo testing I have received this error 4051, after checking my ordersend() lines I have come to the conclusion that everything is in order.

Please note that I added the clr before the colour names as this was suggested by the new mql4 syntax.

OrderSend(Symbol(),OP_BUY,LotSize/8,Ask,7,0,0,NULL,MagicNumber,0,clrGreen);
.
.
.
.
OrderSend(Symbol(),OP_SELL,LotSize/8,Bid,7,0,0,NULL,MagicNumber,0,clrRed);
qjol
3243
qjol 2014.04.02 00:32  
LotSize/8.0

remember to check MODE_MINLOT & MODE_LOTSTEP

Luciano Ola
996
Luciano Ola 2014.04.02 00:41  
qjol:

remember to check MODE_MINLOT & MODE_LOTSTEP


I've been printing the Lotsize and it says I'm trying to buy zero lots?? this is just happening immediately after the EA initialises. I could wait a couple of days and see if it happens again.
Luciano Ola
996
Luciano Ola 2014.04.02 00:43  
No I just checked the conditions and it should have made orders by now.
Luciano Ola
996
Luciano Ola 2014.04.02 00:43  
Min lot and max lot are part of my comment()s.
qjol
3243
qjol 2014.04.02 00:48  
MetaNt:
Min lot and max lot are part of my comment()s.

but not in the calculation of the LotSize
Luciano Ola
996
Luciano Ola 2014.04.02 00:54  
qjol:

but not in the code


What I meant was that the minlot is 0.01 the maxlot is 100 (as calculated and commented on the chart) the volume of the trade is well within these limits (as calculated and commented on the chart)

qjol
3243
qjol 2014.04.02 01:03  

are you sure the returning error code 4051 is from OrderSend ?

try:

ResetLastError

OrderSend(....

GetLastError();

Luciano Ola
996
Luciano Ola 2014.04.02 01:06  
Ah fixed it, it was an initialisation issue, I needed to define Lotsize during initialisation.
qjol
3243
qjol 2014.04.02 01:12  

regardless (or not) why use a calculation (LotSize/8) inside OrderSend function

especially when it can cause problems such as error 131

Luciano Ola
996
Luciano Ola 2014.04.02 01:18  
qjol:

regardless (or not) why use a calculation (LotSize/8) inside OrderSend function

especially when it can cause problems such as error 131


Just further scaling it's part of the strategy, there is most likely a better alternative.
/ /12
To add comments, please log in or register