Download MetaTrader 5

Should I login to my account before sending orders in MT5?

To add comments, please log in or register
sd2000sd
212
sd2000sd  

Should I login to my account before sending orders in MT5?

I mean before using commands like: Ordersend(), should I send user information to server? should I do somehting else? because the server rejects all of my orders, but when I manually put them there is no error.

sd2000sd
212
sd2000sd  

I want to send an order to the server using CTrade class.

I want to send the following order to the server:

Type: buyLimit

Volume: 1000

Price: 3000

Stop Loss: 0

Take profit = 0

Fill policy= return

Expiration: Today

 

what is the complete needed code for that?

should I use CTrade.OrderOpen() method first and then use CTrade.OrderSend()?

or is it just enough to use CTrade.BuyLimit() method?

Please explain

thanks

Alain Verleyen
Moderator
35118
Alain Verleyen  
sd2000sd:

I want to send an order to the server using CTrade class.

I want to send the following order to the server:

Type: buyLimit

Volume: 1000

Price: 3000

Stop Loss: 0

Take profit = 0

Fill policy= return

Expiration: Today

 

what is the complete needed code for that?

should I use CTrade.OrderOpen() method first and then use CTrade.OrderSend()?

or is it just enough to use CTrade.BuyLimit() method?

Please explain

thanks

Show your code.
sd2000sd
212
sd2000sd  
angevoyageur:
Show your code.
CTrade trade;
trade.SetTypeFilling(ORDER_FILLING_RETURN);
   
   trade.OrderOpen(Symbol(),ORDER_TYPE_BUY_LIMIT,300,0,3746,0,0,ORDER_TIME_DAY,0,"comment");
   
   trade.BuyLimit(300,3746,Symbol(),0,0,ORDER_TIME_DAY,0,"comment");
Simon Gniadkowski
Moderator
18056
Simon Gniadkowski  
sd2000sd:

Should I login to my account before sending orders in MT5?

I mean before using commands like: Ordersend(), should I send user information to server? should I do somehting else? because the server rejects all of my orders, but when I manually put them there is no error.

How does the Server know what account the Order is for if you haven't logged in ?
sd2000sd
212
sd2000sd  
RaptorUK:
How does the Server know what account the Order is for if you haven't logged in ?
you're right
To add comments, please log in or register