วันจันทร์ที่ 22 พฤษภาคม พ.ศ. 2560

ฝึกเขียน EA คำสั่งเปิดออร์เดอร์

int  OrderSend(
   string   symbol,              // symbol
   int      cmd,                 // operation
   double   volume,              // volume
   double   price,               // price
   int      slippage,            // slippage
   double   stoploss,            // stop loss
   double   takeprofit,          // take profit
   string   comment=NULL,        // comment
   int      magic=0,             // magic number
   datetime expiration=0,        // pending order expiration
   color    arrow_color=clrNONE  // color
   );
Parameters 

  • symbol [in] Symbol for trading. 
  • cmd [in] Operation type. It can be any of the Trade operation enumeration. 
  • volume [in] Number of lots. 
  • price [in] Order price. 
  • slippage [in] Maximum price slippage for buy or sell orders. 
  • stoploss [in] Stop loss level. 
  • takeprofit [in] Take profit level. 
  • comment=NULL [in] Order comment text. Last part of the comment may be changed by server. 
  • magic=0 [in] Order magic number. May be used as user defined identifier. 
  • expiration=0 [in] Order expiration time (for pending orders only). 
  • arrow_color=clrNONE [in] Color of the opening arrow on the chart. If parameter is missing or has CLR_NONE value opening arrow is not drawn on the chart. 

Returned value 
Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function.


cmd. (operation )
Value
Description
OP_BUY
0
Buy operation
OP_SELL
1
Sell operation
OP_BUYLIMIT
2
Buy limit pending order
OP_SELLLIMIT
3
Sell limit pending order
OP_BUYSTOP
4
Buy stop pending order
OP_SELLSTOP
5
Sell stop pending order

ไม่มีความคิดเห็น:

แสดงความคิดเห็น