Download MetaTrader 5

Finding it difficult to send orders.

To add comments, please log in or register
Luciano Ola
1007
Luciano Ola  

I keep getting the error "invalid volume", the account balance is 10 000 and the lot size is 0.07.

 

 

This is my code, I think it might not be the volume tbh. 

 

MqlTradeResult StageOneBuyRes={0};
MqlTradeRequest StageOneBuy={0};

StageOneBuy.action=TRADE_ACTION_DEAL;  
StageOneBuy.magic=MagicNumber;  
StageOneBuy.symbol=_Symbol;            // symbol
StageOneBuy.volume=Lot;
StageOneBuy.price=SymbolInfoDouble(_Symbol,SYMBOL_ASK);
StageOneBuy.sl=0;                  // Stop Loss is not specified
StageOneBuy.tp=0;                 // Take Profit is not specified 
StageOneBuy.deviation =7;  
StageOneBuy.type=ORDER_TYPE_BUY; // order type
StageOneBuy.type_filling = ORDER_FILLING_FOK;
StageOneBuy.comment = "test";
 

MqlTradeResult StageOneSellRes={1};
MqlTradeRequest StageOneSell={1};

StageOneSell.action=TRADE_ACTION_DEAL;  
StageOneSell.magic=MagicNumber;  
StageOneSell.symbol=_Symbol;            // symbol
StageOneSell.volume=Lot;
StageOneSell.price=SymbolInfoDouble(_Symbol,SYMBOL_BID);
StageOneSell.sl=0;                  // Stop Loss is not specified
StageOneSell.tp=0;                 // Take Profit is not specified 
StageOneSell.deviation =7;  
StageOneSell.type=ORDER_TYPE_SELL; // order type
StageOneSell.type_filling = ORDER_FILLING_FOK;
StageOneSell.comment = "test";
Alain Verleyen
Moderator
31203
Alain Verleyen  
MetaNt:

I keep getting the error "invalid volume", the account balance is 10 000 and the lot size is 0.07.

 

 

This is my code, I think it might not be the volume tbh. 

 

What is the minimum volume allowed by your broker for this symbol ?
Luciano Ola
1007
Luciano Ola  
angevoyageur:
What is the minimum volume allowed by your broker for this symbol ?
0.01.
Snelle Moda
607
Snelle Moda  
MetaNt:

I keep getting the error "invalid volume", the account balance is 10 000 and the lot size is 0.07.

 

 

This is my code, I think it might not be the volume tbh. 

 

I had a similar problem with my EA (got the same error). The traded volume was lower than the minimum allowed trading size of my broker or the increment/step size was to small. 

(Check the minimum volume size of your broker, maybe the minimum trading size or increment/step size is larger than your 0.07)  "already done"

Is the variable "Lot" of the double type?

Luciano Ola
1007
Luciano Ola  
snelle_moda:

I had a similar problem with my EA (got the same error). The traded volume was lower than the minimum allowed trading size of my broker or the increment/step size was to small. 

Check the minimum volume size of your broker, maybe the minimum trading size or increment/step size is larger than your 0.07.

Is the variable "Lot" of the double type?

It's of the double type, I haven't set an increment.

 

I tried to use 1 as the order Lot value earlier to see if it would work, and the error persisted, I'll try and use 10 now. 

Luciano Ola
1007
Luciano Ola  
It didn't work.
Snelle Moda
607
Snelle Moda  

Use

ZeroMemory(StageOneBuy);

ZeroMemory(StageOneSell);


Before you fill in the request and send the order.

Alain Verleyen
Moderator
31203
Alain Verleyen  
snelle_moda:

Use

ZeroMemory(StageOneBuy);

ZeroMemory(StageOneSell);


Before you fill in the request and send the order.

It's already done with {0}. Exactly the same.
Luciano Ola
1007
Luciano Ola  
angevoyageur:
It's already done with {0}. Exactly the same.
Initially both were 0 but I changed the sell one to 1 to see if that would solve the problem, which is why it says one in the code I posted.
Luciano Ola
1007
Luciano Ola  
MetaNt:
Initially both were 0 but I changed the sell one to 1 to see if that would solve the problem, which is why it says one in the code I posted.
Btw when I ran print to get the error code I was getting error code 4756, this is an invalid entry error, so it was not much help.
Luciano Ola
1007
Luciano Ola  
Any suggestions?
1234
To add comments, please log in or register