no-image

Automatic judgment method of whether the transaction execution mode is countdown method or market order method

Overview

When placing a market order from the MQL program,
The transaction execution mode of the relevant securities company MT4 server needs to be changed depending on the difference between the “marketing method” and the “countdown method”.

In particular,

In the case of "marketing method", there is no problem because it is possible to set the order of profit order and profit / loss settings as a set,

In the case of “countdown method”, it is not possible to set market orders and profit / loss settings as a set.

(1) Market order placement (profit and profit are set to 0)

(2) Adjust profit / loss.

Must be processed separately.

In addition, automatic determination can be made by writing the following details in the MQL program.

◎ Details

1.Declaring transaction execution mode variables
ENUM_SYMBOL_INFO_INTEGER TradeExeMode;

2. Get the transaction execution mode in the initialization function.

int init () {

// Get transaction execution mode
TradeExeMode = SymbolInfoInteger (Symbol (), SYMBOL_TRADE_EXEMODE);
Print (“TradeExeMode =”, TradeExeMode);

return (0);
}

3. In the ordering function, the process of the market method and the countdown method is branched.

////////////////////
// SYMBOL_TRADE_EXECUTION_REQUEST 0
// SYMBOL_TRADE_EXECUTION_INSTANT 1
// SYMBOL_TRADE_EXECUTION_MARKET 2
// SYMBOL_TRADE_EXECUTION_EXCHANGE 3
////////////////////
int doOrderSend (
// In case of market method
if (TradeExeMode == 0 || TradeExeMode == 1) {
}

// Countdown method
else {
}
}

Translate »