myeatrade

MQL4 Reference

MQL4 Standard constants(1)

To simplify the program writing and to make program texts more convenient for perception, predefined standard constants are forseen in MQL4.

Standard constants are similar to macro substitutions and are of int type.

The constants are grouped by their purposes.

Series arrays

Series array identifier used with ArrayCopySeries(), iHighest() and iLowest() functions.

It can be any of the following values:

Constant Value Description
MODE_OPEN 0 Open price.
MODE_LOW 1 Low price.
MODE_HIGH 2 High price.
MODE_CLOSE 3 Close price.
MODE_VOLUME 4 Volume, used in iLowest() and iHighest() functions.
MODE_TIME 5 Bar open time, used in ArrayCopySeries() function.

Timeframes

Timeframe of the chart (chart period). It can be any of the following values:

Constant Value Description
PERIOD_M1 1 1 minute.
PERIOD_M5 5 5 minutes.
PERIOD_M15 15 15 minutes.
PERIOD_M30 30 30 minutes.
PERIOD_H1 60 1 hour.
PERIOD_H4 240 4 hour.
PERIOD_D1 1440 Daily.
PERIOD_W1 10080 Weekly.
PERIOD_MN1 43200 Monthly.
0 (zero) 0 Timeframe used on the chart.

Trade operations

Operation type for the OrderSend() function. It can be any of the following values:

Constant Value Description
OP_BUY 0 Buying position.
OP_SELL 1 Selling position.
OP_BUYLIMIT 2 Buy limit pending position.
OP_SELLLIMIT 3 Sell limit pending position.
OP_BUYSTOP 4 Buy stop pending position.
OP_SELLSTOP 5 Sell stop pending position.

Price constants

Applied price constants. It can be any of the following values:

Constant Value Description
PRICE_CLOSE 0 Close price.
PRICE_OPEN 1 Open price.
PRICE_HIGH 2 High price.
PRICE_LOW 3 Low price.
PRICE_MEDIAN 4 Median price, (high+low)/2.
PRICE_TYPICAL 5 Typical price, (high+low+close)/3.
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.

MarketInfo

Market information identifiers, used with MarketInfo() function.

It can be any of the following values:

Constant Value Description
MODE_LOW 1 Low day price.
MODE_HIGH 2 High day price.
MODE_TIME 5 The last incoming tick time (last known server time).
MODE_BID 9 Last incoming bid price. For the current symbol, it is stored in the predefined variable Bid
MODE_ASK 10 Last incoming ask price. For the current symbol, it is stored in the predefined variable Ask
MODE_POINT 11 Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point
MODE_DIGITS 12 Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits
MODE_SPREAD 13 Spread value in points.
MODE_STOPLEVEL 14 Stop level in points.
MODE_LOTSIZE 15 Lot size in the base currency.
MODE_TICKVALUE 16 Tick value in the deposit currency.
MODE_TICKSIZE 17 Tick size in points.
MODE_SWAPLONG 18 Swap of the long position.
MODE_SWAPSHORT 19 Swap of the short position.
MODE_STARTING 20 Market starting date (usually used for futures).
MODE_EXPIRATION 21 Market expiration date (usually used for futures).
MODE_TRADEALLOWED 22 Trade is allowed for the symbol.
MODE_MINLOT 23 Minimum permitted amount of a lot.
MODE_LOTSTEP 24 Step for changing lots.
MODE_MAXLOT 25 Maximum permitted amount of a lot.
MODE_SWAPTYPE 26 Swap calculation method. 0 – in points; 1 – in the symbol base currency; 2 – by interest; 3 – in the margin currency.
MODE_PROFITCALCMODE 27 Profit calculation mode. 0 – Forex; 1 – CFD; 2 – Futures.
MODE_MARGINCALCMODE 28 Margin calculation mode. 0 – Forex; 1 – CFD; 2 – Futures; 3 – CFD for indices.
MODE_MARGININIT 29 Initial margin requirements for 1 lot.
MODE_MARGINMAINTENANCE 30 Margin to maintain open positions calculated for 1 lot.
MODE_MARGINHEDGED 31 Hedged margin calculated for 1 lot.
MODE_MARGINREQUIRED 32 Free margin required to open 1 lot for buying.
MODE_FREEZELEVEL 33 Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed.

Drawing styles

Drawing shape style enumeration for SetIndexStyle() function.

It can be any of the following values:

Constant Value Description
DRAW_LINE 0 Drawing line.
DRAW_SECTION 1 Drawing sections.
DRAW_HISTOGRAM 2 Drawing histogram.
DRAW_ARROW 3 Drawing arrows (symbols).
DRAW_ZIGZAG 4 Drawing sections between even and odd indicator buffers.
DRAW_NONE 12 No drawing.

Drawing style. Valid when width=1. It can be any of the following values:

Constant Value Description
STYLE_SOLID 0 The pen is solid.
STYLE_DASH 1 The pen is dashed.
STYLE_DOT 2 The pen is dotted.
STYLE_DASHDOT 3 The pen has alternating dashes and dots.
STYLE_DASHDOTDOT 4 The pen has alternating dashes and double dots.

Arrow codes

Predefined Arrow codes enumeration. Arrows code constants. It can be one of the following values:

Constant Value Description
SYMBOL_THUMBSUP 67 Thumb up symbol (C).
SYMBOL_THUMBSDOWN 68 Thumb down symbol (D).
SYMBOL_ARROWUP 241 Arrow up symbol (ñ).
SYMBOL_ARROWDOWN 242 Arrow down symbol (ò).
SYMBOL_STOPSIGN 251 Stop sign symbol (û).
SYMBOL_CHECKSIGN 252 Check sign symbol (ü).

Special Arrow codes that exactly points to price and time. It can be one of the following values:

Constant Value Description
  1 Upwards arrow with tip rightwards ().
  2 Downwards arrow with tip rightwards ().
  3 Left pointing triangle ().
  4 En Dash symbol (–).
SYMBOL_LEFTPRICE 5 Left sided price label.
SYMBOL_RIGHTPRICE 6 Right sided price label.
This article url: http://www.myeatrade.com/423/

Please login to post comment, if you haven't account you can register free