OrderType 0

 

I am debugging an EA script. WHat is ordertype 0 ?

The MQL4 book only ciontains the names eg BUY


for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()==Symbol())
{
Print ("OT: " + OrderType()); //debug


etc...

 
SanMiguel:

I am debugging an EA script. WHat is ordertype 0 ?

The MQL4 book only ciontains the names eg BUY

0 is OP_BUY, 1 is OP_SELL etc. You can get the numeric values for these kinds of constant in a number of ways, including running a simple script such as the following:


int start()

{

   MessageBox("OP_BUY = " + OP_BUY);

   MessageBox("OP_SELL = " + OP_SELL);

}


As a matter of passing interest, you'll occasionally see code posted on this forum which distinguishes between open and pending orders using a test such as OrderType() < 2 or OrderType() <= OP_SELL. This works because zero and 1 are the codes for open orders, and the various types of pending orders (buy/sell stop/limit) start at 2.

Reason: