固定字


MetaQuotes 4 语言使用下面的几组固定字。


1. 逻辑符号。

AND, NOT, OR.


2. MQL 4语言指令。

Array, Begin, Break, Continue, Define, Downto, Else, End, Exit, For, If, Input, Then, To, Variable, While。界定语言指令结构的固定字也叫做关键字。


3. 内置函数。

Abs, AccName, AccountName, Alert, Ceil, CloseOrder, Comment, Cos, CurTime, Day, DayOfWeek, DeleteOrder, Exp, Floor, Highest, Hour, iADX, iATR, iBANDS, iCCI, iMA, iMACD, iMFI, iMOM, iRSI, iSAR, iSTO, iWPR, IsDemo, IsIndirect, LastTradeTime, Log, Lowest, Minute, Mod, ModifyOrder, Month, MoveObject, NumberToStr, Ord, OrderValue, Period, Pow, Print, PrintTrade, Rand, Round, ServerAddress, SetArrow, SetObjectText, SetOrder, SetText, Sin, Sqrt, Srand, Symbol, Tan, TimeToStr, Year.


4. 预先设定用户变量(用户定义变量)。

Lots, StopLoss, TakeProfit, TrailingStop.


5. 预先设定交易终端变量。

AccNum, AccountNumber, Ask, Balance, Bars, Bid, Close, Credit, Equity, FreeMargin, High, Low, Margin, Open, Point, PriceAsk, PriceBid, PriceHigh, PriceLow, PriceTime, Time, TotalProfit, TotalTrades, Volume.


6. 预先设定内置函数参数(宏命令)。

MODE_CLOSE, MODE_EMA, MODE_HIGH, MODE_LOW, MODE_MAIN, MODE_MINUSDI, MODE_OPEN, MODE_PLUSDI, MODE_SIGNAL, MODE_SMA, MODE_STOPLOSS, MODE_TAKEPROFIT, MODE_VOLUME, MODE_WMA, OBJ_HLINE, OBJ_SYMBOL, OBJ_TEXT, OBJ_TRENDLINE, OBJ_VLINE, OP_BUY, OP_BUYLIMIT, OP_BUYSTOP, OP_SELL, OP_SELLLIMIT, OP_SELLSTOP, SYMBOL_ARROWDOWN, SYMBOL_ARROWUP, SYMBOL_CHECKSIGN, SYMBOL_STOPSIGN, SYMBOL_THUMBSDOWN, SYMBOL_THUMBSUP, VAL_CLOSEPRICE, VAL_CLOSETIME, VAL_COMISSION, VAL_COMMENT, VAL_LOTS, VAL_OPENPRICE, VAL_OPENTIME, VAL_PROFIT, VAL_STOPLOSS, VAL_SWAP, VAL_SYMBOL, VAL_TAKEPROFIT, VAL_TICKET, VAL_TYPE.


实际上,上述固定字为宏记录器,即语法分析程序用数值取而代之。宏记录器的引入简化了编写用户功能要求的程序:更加方便、无关联的重要词语可以用来替代一些函数参数值。同样可以用于色彩名称。


7. 色彩。

AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond, Blue, BlueViolet, Brown, BurlyWood, CadetBlue, Chartreuse, Chocolate, Coral, CornflowerBlue, Cornsilk, Crimson, Cyan, DarkBlue, DarkCyan, DarkGoldenrod, DarkGray, DarkGreen, DarkKhaki, DarkMagenta, DarkOliveGreen, DarkOrange, DarkOrchid, DarkRed, DarkSalmon, DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkTurquoise, DarkViolet, DeepPink, DeepSkyBlue, DimGray, DodgerBlue, FireBrick, FloralWhite, ForestGreen, Fuchsia, Gainsboro, GhostWhite, Gold, Goldenrod, Gray, Green, GreenYellow, Honeydew, HotPink, IndianRed, Indigo, Ivory, Khaki, Lavender, LavenderBlush, LawnGreen, LemonChiffon, LightBlue, LightCoral, LightCyan, LightGoldenrod, LightGreen, LightGrey, LightPink, LightSalmon, LightSeaGreen, LightSkyBlue, LightSlateGray, LightSteelBlue, LightYellow, Lime, LimeGreen, Linen, Magenta, Maroon, MediumAquamarine, MediumBlue, MediumOrchid, MediumPurple, MediumSeaGreen, MediumSlateBlue, MediumSpringGreen, MediumTurquoise, MediumVioletRed, MidnightBlue, MintCream, MistyRose, Moccasin, NavajoWhite, Navy, OldLace, Olive, OliveDrab, Orange, OrangeRed, Orchid, PaleGoldenrod, PaleGreen, PaleTurquoise, PaleVioletRed, PapayaWhip, PeachPuff, Peru, Pink, Plum, PowderBlue, Purple, Red, RosyBrown, RoyalBlue, SaddleBrown, Salmon, SandyBrown, SeaGreen, Seashell, Sienna, Silver, SkyBlue, SlateBlue, SlateGray, Snow, SpringGreen, SteelBlue, Tan, Teal, Thistle, Tomato, Turquoise, Violet, Wheat, White, WhiteSmoke, Yellow, YellowGreen.


所有的固定字均是非敏感字号,即它们可以小写也可以大写。


4.1. 智能交易系统向导


智能交易系统向导提示MQL 4允许编写智能交易系统、自编指标、自编脚本和从模板中进行编辑


预先设定参数或变量的名称,将会自动在文本编辑栏中出现参数框架。