1
votes

I still don't know how code to open multiple orders in EA. I saw some EA open orders multiple times example buy order open first time and next buy order will open after direction is correct. How can code it. Thanks you.

1

1 Answers

0
votes

Q : How open multiple orders in EA?

for example this way:

#define NotSetHERE 0.
int retCode = OrderSend( _Symbol,    // string   symbol,               // symbol
                         OP_BUY,     // int      cmd,                  // operation
                         1.0,        // double   volume,               // volume
                         Ask,        // double   price,                // price
                         10,         // int      slippage,             // slippage
                         NotSetHERE, // double   stoploss,             // stop loss
                         NotSetHERE, // double   takeprofit,           // take profit
                         "DEMO1",    // string   comment     = NULL,   // comment
                         -1,         // int      magic       = 0,      // magic number
                         0,          // datetime expiration  = 0,      // P/O expiration
                         clrRed      // color    arrow_color = clrNONE // color
                         );
...
...

int retCod2 = OrderSend( "XAGUSD",   // string   symbol,               // symbol
                         OP_BUY,     // int      cmd,                  // operation
                         2.0,        // double   volume,               // volume
                         Ask,        // double   price,                // price
                         10,         // int      slippage,             // slippage
                         NotSetHERE, // double   stoploss,             // stop loss
                         NotSetHERE, // double   takeprofit,           // take profit
                         "DEMO2",    // string   comment     = NULL,   // comment
                         -2,         // int      magic       = 0,      // magic number
                         0,          // datetime expiration  = 0,      // P/O expiration
                         clrWhite    // color    arrow_color = clrNONE // color
                         );

...
...

int retCod3 = OrderSend( "EURCHF",   // string   symbol,               // symbol
                         OP_BUY,     // int      cmd,                  // operation
                         3.0,        // double   volume,               // volume
                         Ask,        // double   price,                // price
                         10,         // int      slippage,             // slippage
                         NotSetHERE, // double   stoploss,             // stop loss
                         NotSetHERE, // double   takeprofit,           // take profit
                         "DEMO3",    // string   comment     = NULL,   // comment
                         -3,         // int      magic       = 0,      // magic number
                         0,          // datetime expiration  = 0,      // P/O expiration
                         clrGreen    // color    arrow_color = clrNONE // color
                         );