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

 

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.

 

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

 
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.
 
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");
 
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 ?
 
RaptorUK:
How does the Server know what account the Order is for if you haven't logged in ?
you're right
 
I just deposited my last 11 dollars in this account but I can't  login to platform what may be the problem?
Reason: