Download MetaTrader 5

OrderSend Problem

To add comments, please log in or register
Have you just installed MetaTrader 5? Learn it in details!
Rinor Memeti
2691
Rinor Memeti 2015.06.30 13:57 

hey i am a rookie in programming, i have the following problem:

Compiler says: 'OrderSend' - declaration without type

 What i should do?

 Code:

// BUY ORDER DEFINITION
   OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage,BuyStopLoss,BuyTakeProfit,"Buy Order",MagicNumber,0,Green);
   
// Sell order definition
   OrderSend(Symbol(),OP_SELL,LotSize,Ask,Slippage,BuyStopLoss,BuyTakeProfit,"Sell Order",MagicNumber,0,Red);
soeherman effendy
1256
soeherman effendy 2015.06.30 14:05  

maybe you can  try this

 

 

// BUY ORDER DEFINITION
  ticket=OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage,BuyStopLoss,BuyTakeProfit,"Buy Order",MagicNumber,0,Green);
   
// Sell order definition 
   ticket=OrderSend(Symbol(),OP_SELL,LotSize,Ask,Slippage,BuyStopLoss,BuyTakeProfit,"Sell Order",MagicNumber,0,Red); 
Rinor Memeti
2691
Rinor Memeti 2015.06.30 14:17  
Now it says; 'ticket' - declaration without type
Alain Verleyen
Moderator
30755
Alain Verleyen 2015.06.30 14:37  
Rinor Memeti:

hey i am a rookie in programming, i have the following problem:

Compiler says: 'OrderSend' - declaration without type

 What i should do?

 Code:

Where is placed this code ?

You have to include this code in an event handler (OnTick, OnTimer...) or a function.

Rinor Memeti
2691
Rinor Memeti 2015.06.30 22:06  

Okay thanks. Problem solved =)

 

Can you tell me how to code "maximum number of positions" function ?

searched in the internet but didnt found something useful =/ 

Marco vd Heijden
Moderator
4708
Marco vd Heijden 2015.06.30 22:08  
OrdersTotal()
int orders_max=5;

if(OrdersTotal()<orders_max)
 {
  //Do Something
 }
Rinor Memeti
2691
Rinor Memeti 2015.07.01 11:35  
Nice. Thanks. I will guve it a try
Rinor Memeti
2691
Rinor Memeti 2015.07.01 13:17  

What do you mean with "do something"?

Alain Verleyen
Moderator
30755
Alain Verleyen 2015.07.01 13:26  
Rinor Memeti:

What do you mean with "do something"?

LOL...It means insert there the code you want, when the condition is true.
Rinor Memeti
2691
Rinor Memeti 2015.07.01 13:28  
LOL....okay thanks :D
Marco vd Heijden
Moderator
4708
Marco vd Heijden 2015.07.01 14:33  
dear god...
To add comments, please log in or register