Trading functions
mt4编程手册

交易函数 [Trading Functions].......................................................................................................................107
预处理程序 [Preprocessor]..............................................................................................................................17
账户信息 [Account Information].....................................................................................................................19
窗口函数 [Window Functions]......................................................................................................................115
日期时间函数 [Date & Time Functions].........................................................................................................44
mt4中文帮助命令中文手册

MQL4 Reference MQL4命令手册(本手册采用Office2007编写)2010年2月目录MQL4 Reference (1)MQL4命令手册 (1)Basics基础 (12)Syntax语法 (12)Comments注释 (12)Identifiers标识符 (12)Reserved words保留字 (13)Data types数据类型 (13)Type casting类型转换 (14)Integer constants整数常量 (14)Literal constants字面常量 (14)Boolean constants布尔常量 (15)Floating-point number constants (double)浮点数常量(双精度) (15)String constants字符串常量 (15)Color constants颜色常数 (16)Datetime constants日期时间常数 (16)Operations & Expressions操作表达式 (17)Expressions表达式 (17)Arithmetical operations算术运算 (17)Assignment operation赋值操作 (17)Operations of relation操作关系 (18)Boolean operations布尔运算 (18)Bitwise operations位运算 (19)Other operations其他运算 (19)Precedence rules优先规则 (20)Operators操作符 (21)Compound operator复合操作符 (21)Expression operator表达式操作符 (21)Break operator终止操作符 (21)Continue operator继续操作符 (22)Return operator返回操作符 (22)Conditional operator if-else条件操作符 (23)Switch operator跳转操作符 (23)Cycle operator while循环操作符while (24)Cycle operator for循环操作符for (24)Functions函数 (25)Function call函数调用 (26)Special functions特殊函数 (27)Variables变量 (27)Local variables局部变量 (28)Formal parameters形式变量 (28)Static variables静态变量 (29)Global variables全局变量 (29)Defining extern variables外部定义变量 (30)Initialization of variables初始化变量 (30)External functions definition外部函数的定义 (30)Preprocessor预处理 (31)Constant declaration常量声明 (31)Controlling compilation编译控制 (32)Including of files包含文件 (32)Importing of functions导入功能 (33)Standard constants标准常数 (35)Series arrays系列数组 (35)Timeframes图表周期时间 (35)Trade operations交易操作 (36)Price constants价格常数 (36)MarketInfo市场信息识别符 (36)Drawing styles画线风格 (37)Arrow codes预定义箭头 (38)Wingdings宋体 (39)Web colors颜色常数 (39)Indicator lines指标线 (40)Ichimoku Kinko Hyo (41)Moving Average methods移动平均方法 (41)MessageBox信息箱 (41)Object types对象类型 (43)Object properties对象属性 (44)Object visibility (45)Uninitialize reason codes撤销初始化原因代码 (45)Special constants特别常数 (46)Error codes错误代码 (46)Predefined variables预定义变量 (50)Ask最新卖价 (50)Bars柱数 (50)Bid最新买价 (50)Close[]收盘价 (51)Digits汇率小数位 (51)High[]最高价 (51)Low[]最低价 (52)Open[]开盘价 (53)Point点值 (53)Time[]开盘时间 (53)Volume[]成交量 (54)Program Run程序运行 (56)Program Run程序运行 (56)Imported functions call输入函数调用 (57)Runtime errors运行错误 (57)Account information账户信息 (68)AccountBalance( )账户余额 (68)AccountCredit( )账户信用点数 (68)AccountCompany( )账户公司名 (68)AccountCurrency( )基本货币 (68)AccountEquity( )账户资产净值 (68)AccountFreeMargin( )账户免费保证金 (69)AccountFreeMarginCheck()账户当前价格自由保证金 (69)AccountFreeMarginMode( )账户免费保证金模式 (69)AccountLeverage( )账户杠杆 (69)AccountMargin( )账户保证金 (69)AccountName( )账户名称 (70)AccountNumber( )账户数字 (70)AccountProfit( )账户利润 (70)AccountServer( )账户连接服务器 (70)AccountStopoutLevel( )账户停止水平值 (70)AccountStopoutMode( )账户停止返回模式 (71)Array functions数组函数 (72)ArrayBsearch()数组搜索 (72)ArrayCopy()数组复制 (72)ArrayCopyRates()数组复制走势 (73)ArrayCopySeries()数组复制系列走势 (74)ArrayDimension()返回数组维数 (75)ArrayGetAsSeries()返回数组序列 (75)ArrayInitialize()数组初始化 (75)ArrayIsSeries()判断数组连续 (75)ArrayMaximum()数组最大值定位 (76)ArrayMinimum()数组最小值定位 (76)ArrayRange()返回数组指定维数数量 (76)ArrayResize()改变数组维数 (77)ArraySetAsSeries()设定系列数组 (77)ArraySize()返回数组项目数 (78)ArraySort()数组排序 (78)Checkup检查 (79)GetLastError( )返回最后错误 (79)IsConnected( )返回联机状态 (79)IsDemo( )返回模拟账户 (79)IsDllsAllowed( )返回dll允许调用 (80)IsExpertEnabled( )返回智能交易开启状态 (80)IsLibrariesAllowed( )返回数据库函数调用 (80)IsOptimization( )返回策略测试中优化模式 (81)IsStopped( )返回终止业务 (81)IsTesting( )返回测试模式状态 (81)IsTradeAllowed( )返回允许智能交易 (81)IsTradeContextBusy( )返回其他智能交易忙 (82)IsVisualMode( )返回智能交易“图片模式” (82)UninitializeReason( )返回智能交易初始化原因 (82)Client terminal客户端信息 (83)TerminalCompany( )返回客户端所属公司 (83)TerminalName( )返回客户端名称 (83)TerminalPath( )返回客户端文件路径 (83)Common functions常规命令函数 (84)Alert弹出警告窗口 (84)Comment显示信息在走势图左上角 (84)GetTickCount获取时间标记 (84)MarketInfo在市场观察窗口返回不同数据保证金列表 (85)MessageBox创建信息窗口 (85)PlaySound播放声音 (86)Print窗口中显示文本 (86)SendFTP设置FTP (86)SendMail设置Email (87)Sleep指定的时间间隔内暂停交易业务 (87)Conversion functions格式转换函数 (88)CharToStr字符转换成字符串 (88)DoubleToStr双精度浮点转换成字符串 (88)NormalizeDouble给出环绕浮点值的精确度 (88)StrToDouble字符串型转换成双精度浮点型 (89)StrToInteger字符串型转换成整型 (89)StrToTime字符串型转换成时间型 (89)TimeToStr时间类型转换为"yyyy.mm.dd hh:mi"格式 (89)Custom indicators自定义指标 (91)IndicatorBuffers (91)IndicatorCounted (92)IndicatorDigits (92)IndicatorShortName (93)SetIndexArrow (94)SetIndexBuffer (94)SetIndexDrawBegin (95)SetIndexEmptyValue (95)SetIndexLabel (96)SetIndexShift (97)SetIndexStyle (98)SetLevelStyle (98)SetLevelValue (99)Date & Time functions日期时间函数 (100)Day (100)DayOfWeek (100)Hour (100)Minute (101)Month (101)Seconds (101)TimeCurrent (101)TimeDay (102)TimeDayOfWeek (102)TimeDayOfYear (102)TimeHour (102)TimeLocal (102)TimeMinute (103)TimeMonth (103)TimeSeconds (103)TimeYear (103)Year (104)File functions文件函数 (105)FileClose关闭文件 (105)FileDelete删除文件 (105)FileFlush将缓存中的数据刷新到磁盘上去 (106)FileIsEnding文件结尾 (106)FileIsLineEnding (107)FileOpen打开文件 (107)FileOpenHistory历史目录中打开文件 (108)FileReadArray将二进制文件读取到数组中 (108)FileReadDouble从文件中读取浮点型数据 (109)FileReadInteger从当前二进制文件读取整形型数据 (109)FileReadNumber (109)FileReadString从当前文件位置读取字串符 (110)FileSeek文件指针移动 (110)FileSize文件大小 (111)FileTell文件指针的当前位置 (111)FileWrite写入文件 (112)FileWriteArray一个二进制文件写入数组 (112)FileWriteDouble一个二进制文件以浮动小数点写入双重值 (113)FileWriteInteger一个二进制文件写入整数值 (113)FileWriteString当前文件位置函数写入一个二进制文件字串符 (114)Global variables全局变量 (115)GlobalVariableCheck (115)GlobalVariableDel (115)GlobalVariableGet (115)GlobalVariableName (116)GlobalVariableSet (116)GlobalVariableSetOnCondition (116)GlobalVariablesTotal (117)Math & Trig数学和三角函数 (119)MathAbs (119)MathArccos (119)MathArcsin (119)MathArctan (120)MathCeil (120)MathCos (120)MathExp (121)MathFloor (121)MathLog (122)MathMax (122)MathMin (122)MathMod (122)MathPow (123)MathRand (123)MathRound (123)MathSin (124)MathSqrt (124)MathSrand (124)MathTan (125)Object functions目标函数 (126)ObjectCreate建立目标 (126)ObjectDelete删除目标 (127)ObjectDescription目标描述 (127)ObjectFind查找目标 (127)ObjectGet目标属性 (128)ObjectGetFiboDescription斐波纳契描述 (128)ObjectGetShiftByValue (128)ObjectGetValueByShift (129)ObjectMove移动目标 (129)ObjectName目标名 (129)ObjectsDeleteAll删除所有目标 (130)ObjectSet改变目标属性 (130)ObjectSetFiboDescription改变目标斐波纳契指标 (131)ObjectSetText改变目标说明 (131)ObjectsTotal返回目标总量 (131)ObjectType返回目标类型 (132)String functions字符串函数 (133)StringConcatenate字符串连接 (133)StringFind字符串搜索 (133)StringGetChar字符串指定位置代码 (133)StringLen字符串长度 (134)StringSubstr提取子字符串 (134)StringTrimLeft (135)StringTrimRight (135)Technical indicators技术指标 (136)iAC比尔.威廉斯的加速器或减速箱振荡器 (136)iAD离散指标 (136)iAlligator比尔・威廉斯的鳄鱼指标 (136)iADX移动定向索引 (137)iATR平均真实范围 (137)iAO比尔.威廉斯的振荡器 (138)iBearsPower熊功率指标 (138)iBands保力加通道技术指标 (138)iBandsOnArray保力加通道指标 (139)iBullsPower牛市指标 (139)iCCI商品通道索引指标 (139)iCCIOnArray商品通道索引指标 (140)iCustom指定的客户指标 (140)iDeMarker (140)iEnvelopes包络指标 (141)iEnvelopesOnArray包络指标 (141)iForce强力索引指标 (142)iFractals分形索引指标 (142)iGator随机震荡指标 (142)iIchimoku (143)iBWMFI比尔.威廉斯市场斐波纳契指标 (143)iMomentum动量索引指标 (143)iMomentumOnArray (144)iMFI资金流量索引指标 (144)iMA移动平均指标 (144)iMAOnArray (145)iOsMA移动振动平均震荡器指标 (145)iMACD移动平均数汇总/分离指标 (146)iOBV能量潮指标 (146)iSAR抛物线状止损和反转指标 (146)iRSI相对强弱索引指标 (147)iRSIOnArray (147)iRVI相对活力索引指标 (147)iStdDev标准偏差指标 (148)iStdDevOnArray (148)iStochastic随机震荡指标 (148)iWPR威廉指标 (149)Timeseries access时间序列图表数据 (150)iBars柱的数量 (150)iClose (150)iHigh (151)iHighest (151)iLow (152)iLowest (152)iOpen (152)iTime (153)iVolume (153)Trading functions交易函数 (155)Execution errors (155)OrderClose (157)OrderCloseBy (158)OrderClosePrice (158)OrderCloseTime (158)OrderComment (159)OrderCommission (159)OrderDelete (159)OrderExpiration (160)OrderLots (160)OrderMagicNumber (160)OrderModify (160)OrderOpenPrice (161)OrderOpenTime (161)OrderPrint (162)OrderProfit (162)OrderSelect (162)OrderSend (163)OrdersHistoryTotal (164)OrderStopLoss (164)OrdersTotal (164)OrderSwap (165)OrderSymbol (165)OrderTakeProfit (165)OrderTicket (166)OrderType (166)Window functions窗口函数 (167)HideTestIndicators隐藏指标 (167)Period使用周期 (167)RefreshRates刷新预定义变量和系列数组的数据 (167)Symbol当前货币对 (168)WindowBarsPerChart可见柱总数 (168)WindowExpertName智能交易系统名称 (169)WindowFind返回名称 (169)WindowFirstVisibleBar第一个可见柱 (169)WindowHandle (169)WindowIsVisible图表在子窗口中可见 (170)WindowOnDropped (170)WindowPriceMax (170)WindowPriceMin (171)WindowPriceOnDropped (171)WindowRedraw (172)WindowScreenShot (172)WindowTimeOnDropped (173)WindowsTotal指标窗口数 (173)WindowXOnDropped (173)WindowYOnDropped (174)Obsolete functions过时的函数 (175)MetaQuotes Language 4 (MQL4) 是一种新的内置型程序用来编写交易策略。
E-commerce 电子商务

Type your reporting’s name
Associations Object
Demi
Basic Introduce Development Trading partners types Features and Functions Examples
1.trading platform Not the buyer nor seller, but as a trading platform, like entity transactions in the market, relying on the network, and the need for professional technology 2.the operators of the platform Third party trading platform operators Should establish network trading platform management rules and regulations 3.site operators Third party trading platform in the station operator refers to the ecommerce trading platform trading and relevant service activities of natural persons, legal persons and other organizations. 4.the payment system sometimes referred to as the clearing System .
Basic Introduce Development Trading partners types Features and Functions Examples
交易所 常用术语 中英文

交易所常用术语中英文《交易所常用术语》在金融领域,交易所是一个集中化的市场,允许买方和卖方进行买卖交易。
交易所作为金融系统的核心,扮演着重要的角色。
为了能够更好地了解交易所市场,以下是一些常用术语的中英文解释:1. 证券 (Securities):代表可转让的金融资产,包括股票、债券和衍生品等。
2. 交易员 (Trader):在交易所上进行交易的人,负责执行买卖交易以及监督市场。
3. 摊派 (Allocation):将可供买卖的证券按照一定规则分配给不同的交易员或买家的过程。
4. 交易量 (Trading Volume):在特定时间内交易所中进行交易的证券数量。
5. 买盘 (Bid Side):表示买方愿意以某个价格购买证券的盘口。
6. 卖盘 (Ask Side):表示卖方愿意以某个价格出售证券的盘口。
7. 指令 (Order):交易员或投资者发送给交易所的买入或卖出证券的指示。
8. 市价 (Market Order):以当前市场价格立即买入或卖出证券的指令。
9. 限价 (Limit Order):指定买入或卖出证券的最高或最低价格的指令。
10. 成交量 (Volume Executed):在某个时间段内完成的证券交易数量。
11. 报价 (Quote):表示买入或卖出证券的价格和数量的信息。
12. 盈利 (Profit):通过买入证券并以较高价格卖出所获得的差额。
13. 卖空(Short Selling):在没有实际持有证券的情况下卖出证券,希望在价格下跌时买入盈利。
14. 交割 (Settlement):证券交易完成后,买方向卖方支付款项并且证券过户的过程。
15. 挂牌 (Listing):在交易所上将证券列入正式交易的过程。
以上这些术语是交易所市场中经常使用的,了解这些术语可以帮助人们更好地理解交易所市场的运作,并且能够更加有效地进行金融交易。
tradingeconomics指标解释 -回复

tradingeconomics指标解释-回复Trading Economics是一个提供经济数据和金融市场分析的平台。
该平台汇集了全球各个国家和地区的重要经济指标,包括GDP、通胀率、失业率、财政赤字、债务水平、国际贸易等。
这些指标是衡量一个国家经济运行状况和发展趋势的重要参考数据。
Trading Economics提供的经济指标对投资者、分析师、经济学家和政策制定者都非常重要。
通过这些指标,他们可以追踪和分析全球各个国家和地区的经济活动,预测经济发展趋势,制定有效的投资和政策决策。
首先,GDP是衡量一个国家经济总体规模和增长率的指标。
GDP的增长率可以提供一个国家经济增长的快慢和持续性的评估。
通过观察不同国家和地区的GDP数据,投资者和分析师可以了解到哪些地区的经济增长潜力更大,从而进行合理的投资分配。
同时,政府和经济学家也可以利用GDP数据来评估和制定经济政策,促进经济增长和发展。
其次,通胀率是衡量物价水平上涨的指标。
通胀率的水平和趋势对投资者和政策制定者来说都非常重要。
高通胀率可能会降低人们的购买力,影响消费和投资活动。
因此,对投资者来说,他们需要关注通胀率的变化,以便在投资决策中考虑通胀风险。
对政府和央行来说,他们需要通过货币政策来控制通胀率,以维持经济稳定和可持续增长。
失业率是衡量一个国家劳动力市场状况的指标。
失业率高低和趋势可以提供一个国家就业机会的状况和经济活动的健康程度。
对投资者来说,失业率的高水平可能意味着就业市场的竞争激烈,投资机会可能受限。
对政府来说,他们需要通过有效的就业政策来降低失业率,促进经济增长和社会稳定。
财政赤字是衡量一个国家财政状况是否健康的指标。
财政赤字的增加可能意味着政府开支超过收入,需要借债来填补财政缺口。
对投资者来说,财政赤字可能增加国家债务水平,从而增加违约风险和对国家经济稳定的担忧。
对政府来说,控制财政赤字和债务水平是确保财政可持续性和经济稳定的重要举措。
进出口贸易公司介绍英语作文模板

进出口贸易公司介绍英语作文模板Introduction to Import and Export Trading CompanyI. Introduction- Definition of import and export trading company- Importance of import and export trading company in the global market- Purpose of import and export trading companyII. History- Origins of import and export trading company- Evolution of import and export trading company over time- Major milestones in the development of import and export trading companyIII. Functions of Import and Export Trading Company- Identification of potential markets and products- Negotiation and establishment of trade agreements- Logistics and transportation of goods- Customs clearance and compliance with regulations- Payment and financial transactionsIV. Benefits of Import and Export Trading Company- Access to new markets and customers- Diversification of revenue streams- Economies of scale and cost savings- Risk mitigation and insurance coverage- Brand promotion and market expansionV. Challenges Faced by Import and Export Trading Company - Language and cultural barriers- Regulatory and legal constraints- Currency fluctuations and economic instability- Competition from other trading companies- Supply chain disruptions and logistics issuesVI. Future Trends in Import and Export Trading Company- Digitalization and e-commerce- Sustainability and ethical sourcing- Globalization and international trade agreements- Technological advancements in logistics and supply chain management- Shifts in consumer preferences and market trendsVII. Conclusion- Summary of key points- Importance of import and export trading company in the global economy- Potential for growth and innovation in the industry- Challenges and opportunities for import and export trading companies in the futureIn conclusion, import and export trading companies play a crucial role in facilitating international trade and connecting businesses around the world. Despite the challenges and risks involved, the benefits of operating in this industry are immense, and the potential for growth and innovation is promising. By staying informed about the latest trends and developments, import and export trading companies can adapt to changing market conditions and capitalize on new opportunities for success.。
MQL4命令中文手册

Global variables 全局变量 .................................................................................. 29 Defining extern variables 外部定义变量 .............................................................. 30 Initialization of variables 初始化变量 ................................................................... 30 External functions definition 外部函数的定义 ...................................................... 30 Preprocessor 预处理................................................................................................. 31 Constant declaration 常量声明 ........................................................................... 31 Controlling compilation 编译控制 ....................................................................... 32 Including of files 包含文件 ...............................................
交易模式 Trade Pattern

A Planned Entry Leads to A Planned Exit
Trade Chart Patterns Like The Pros
Entries
Entry above/below
– – – – Previous Bar, 2-Bar High or Lows Swing High or Swing Low Breakout/Breakdown (Trendline, Supp./Res., MAs) A Wide-Range Bar
Trade Chart Patterns Like The Pros
Exit: Fibonacci Levels
Use High and Low values Fib. Levels (0.382, 0.618, 1.0, 1.168) Secondary Fib. Levels (0.786, 1.27, 1.38)
– /Reprints/ArticleList.html
Presentations
–
– –
TradersExpo, Trading Groups
Stocks & Commodities (June/Aug. 2007, June 2008), The Trader’s Journal (Sep./Nov./Dec. 2007)
Stocks
8.00 am – 10.30 am – Sell/Close Stocks – No-New Positions 10.30 am – 3.00 pm – Trade ETFs – Pro/UtlraShort shares 3 pm – 5 pm – New Positions (Stocks)
Articles
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
MQL4 COURSEBy Coders’ guru(Appendix 2)Trading Functions--------------------I n this appendix you will find the description of the 25 MQL4 trading functions.I decided to write this appendix before writing the third part of “Your First Expert Advisor” lesson because you have to know these important functions before cracking the remaining of the code.OrderSend:Syntax:int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)Description:The OrderSend function used to open a sell/buy order or to set a pending order.It returns the ticket number of the order if succeeded and -1 in failure.Use GetLastError function to get more details about the error.Note: The ticket number is a unique number returned by OrderSend function which you can use later as a reference of the opened or pending order (for example you can use the ticket number with OrderClose function to close that specific order). Note: GetLastError function returns a predefined number of the last error occurred after an operation (for example when you call GetLastError after OrderSend operation you will get the error number occurred while executing OrderSend).Calling GetLastError will reset the last error number to 0.You can find a full list of MQL4 errors numbers in stderror.mqh file.And you can get the error description for a specific error number by using ErrorDescription function which defined at stdlib.mqh file.Parameters:This function takes 11 parameters:string symbol:The symbol name of the currency pair you trading (Ex: EURUSD and USDJPY). Note: Use Symbol() function to get currently used symbol and OrderSymbol function to get the symbol of current selected order.int cmd:An integer number indicates the type of the operation you want to take; it can be one of these values:Constant Value DescriptionOP_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.Note: You can use the integer representation of the value or the constant name.For example:OrderSend(Symbol(),0,…) is equal to OrderSend(Symbol(),OP_BUY,…) .But it's recommended to use the constant name to make your code clearer.double volume:The number of lots you want to trade.double price:The price you want to open the order at.Use the functions Bid and Ask to get the current bid or ask price.int slippage:The slippage value you assign to the order.Note: slippage is the difference between estimated transaction costs and the amount actually paid.slippage is usually attributed to a change in the spread. ().double stoploss:The price you want to close the order at in the case of losing.double takeprofit:The price you want to close the order at in the case of making profit.string comment:The comment string you want to assign to your order (Figure 1).The default value is NULL which means there's no comment assigned to the order. Note: Default value of a parameter means you can leave (don’t write) it out, and MQL4 will use a predefined value for this parameter.For example we can write OrderSend function with or without comment parameter like this:OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-25*Point,Ask+25*Point,"My order comment",12345,0,Green);Or like this:OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-25*Point,Ask+25*Point,12345,0,Green);int magic:The magic number you assign to the order.Note: Magic number is a number you assign to your order(s) as a reference enables you to distinguish between the different orders. For example the orders you have opened by your expert advisor and the orders have opened manually by the user.Figure 1 - Commentdatetime expiration:The time you want your pending order to expire at.The default time is 0 which means there's no exportation.Note: The time here is the server time not your local time, to get the current server time use CurTime function and to get the local time use LocalTime function.color arrow_color:The color of opening arrow (Figure 2), the default value is CLR_NONE which means there's no arrow will be drawn on the chart.Figure 2 – Arrows colorExample : int ticket;if(iRSI(NULL,0,14,PRICE_CLOSE,0)<25){ ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);if(ticket<0){Print("OrderSend failed with error #",GetLastError());return(0);}}OrderModify:Syntax:bool OrderModify ( int ticket , double price , double stoploss , double takeprofit , datetime expiration , color arrow_color =CLR_NONE)Buy SellStop lossBuy closeSell closeDescription:The OrderModify function used to modify the properties of a specific opened order or pending order with the new values you pass to the function.It returns true if the order successfully modified and false in failure.Use GetLastError function to get more details about the error.Parameters:This function takes 6 parameters:int ticket:The ticket number of the order you want to modify.Note: This number has been assigned to the order by the function OrderSend.You can use the function OrderTicket to get the ticket number of the current order. double price:The price you want to set for the order.Note: Use the function OrderOpenPrice to get the open price for the current order. double stoploss:The price you want to close the order at in the case of losing.double takeprofit:The price you want to close the order at in the case of making profit.Note: We usually use the OrderModify function to change the stoploss and/or takeprofit values and that called Trailing.datetime expiration:The time you want your pending order to expire at.Use 0 if you don't want to set an expiration time.color arrow_color:The color of the arrow, the default value is CLR_NONE which means there's no arrow will be drawn on the chart.Example:if(TrailingStop>0){SelectOrder(12345,SELECT_BY_TICKET);if(Bid-OrderOpenPrice()>Point*TrailingStop){if(OrderStopLoss()<Bid-Point*TrailingStop){OrderModify(OrderTicket(),Ask-10*Point,Ask-35*Point,OrderTakeProfit(),0,Blue);return(0);}}}OrderClose:Syntax:bool OrderClose( int ticket, double lots, double price, int slippage,color Color=CLR_NONE)Description:The OrderClose function used to close a specific opened order (by its ticket).It returns true if the order successfully closed and false in failure.Use GetLastError function to get more details about the error.Parameters:This function takes 5 parameters:int ticket:The ticket number of the order you want to close.double lots:The number of lots you use in the order.Note: Use the OrderLots function to get the lots value of the current order.double price:The price you want to open the order at.Use the functions Bid and Ask to get the current bid or ask price.int slippage:The slippage value of the order.color Color:The color of closing arrow, the default value is CLR_NONE which means there's no arrow will be drawn on the chart.Example:if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75){OrderClose(order_id,1,Ask,3,Red);return(0);}OrderSelect:Syntax:bool OrderSelect( int index, int select, int pool=MODE_TRADES) Description:The OrderSelect function used to select an opened order or a pending order by the ticket number or by index.It returns true if the order successfully selected and false in failure.Use GetLastError function to get more details about the error.Note: You have to use OrderSelect function before the trading functions which takes no parameters:OrderMagicNumber, OrderClosePrice, OrderCloseTime, OrderOpenPrice, OrderOpenTime, OrderComment, OrderCommission, OrderExpiration, OrderLots, OrderPrint, OrderProfit, OrderStopLoss, OrderSwap, OrderSymbol, OrderTakeProfit, OrderTicket and OrderTypeParameters:This function takes 3 parameters:int index:The index or the ticket number of the order you want to select. It depends on the second parameter (selecting type).int select:The type of selecting operation (by index or by ticket number).It can be one of two values:SELECT_BY_POS: use the position (index) of the order.SELECT_BY_TICKET – use the ticket number of the order.int pool:If you used the SELECT_BY_POS selecting type, you have to determine which pool (data) you will select from:MODE_TRADES: select from the currently trading orders (opened and pending orders). This is the default value.MODE_HISTORY: select from the history (closed and canceled orders). Example:if(OrderSelect(12470, SELECT_BY_TICKET)==true){Print("order #12470 open price is ", OrderOpenPrice());Print("order #12470 close price is ", OrderClosePrice());}elsePrint("OrderSelect failed error code is",GetLastError());OrderDelete:Syntax:bool OrderDelete( int ticket)Description:The OrderDelete function used to delete a pending order.It returns true if the order successfully deleted and false in failure.Use GetLastError function to get more details about the error. Parameters:This function takes only 1 parameter:int ticket:The ticket number of the order you want to delete.Example:if(Ask>var1){OrderDelete(order_ticket);return(0);}OrderCloseBy:Syntax:bool OrderCloseBy( int ticket, int opposite, color Color=CLR_NONE) Description:The OrderCloseBy function used to close a specific opened order by opening an opposite direction order.It returns true if the order successfully closed and false in failure.Use GetLastError function to get more details about the error.Parameters:This function takes 3 parameters:int ticket:The ticket number of the order you want to close.int opposite:The ticket number of the order you want to open in the opposite direction.color Color:The color of closing arrow, the default value is CLR_NONE which means no arrow will be drawn on the chart.Example:if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75){OrderCloseBy(order_id,opposite_id);return(0);}OrderType:Syntax:int OrderType( )Description:The OrderType function returns the type of selected order that will be one of:OP_BUY, OP_SELL, OP_BUYLIMIT, OP_BUYSTOP, OP_SELLLIMIT orOP_SELLSTOP (see OrderSend function)The order must be selected by OrderSelect before calling OrderType. Parameters:This function doesn’t take any parameters and returns an integer date type (the type of selected order).Example:int order_type;if(OrderSelect(12, SELECT_BY_POS)==true){order_type=OrderType();// ...}elsePrint("OrderSelect() returned error - ",GetLastError());HistoryTotal:Syntax:int HistoryTotal( )Description:The HistoryTotal function searches the account history loaded in the terminal and returns the number of closed orders.Note: We usually use this function with the OrderSelect function to get information about a specific order in the history.Parameters:This function doesn’t take any parameters and returns an integer (the number of closed orders in the history).Use GetLastError function to get more details about the error.Example:// retrieving info from trade historyint i,hstTotal=HistoryTotal();for(i=0;i<hstTotal;i++){//---- check selection resultif(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false){Print("Access to history failed with error (",GetLastError(),")");break;}// some work with order}OrderClosePrice:Syntax:double OrderClosePrice( )Description:The OrderClosePrice function returns the close price of selected order.The order must be selected by OrderSelect before calling OrderClosePrice. Parameters:This function doesn’t take any parameters and returns a double data type (the close price of the selected order).Example:if(OrderSelect(ticket,SELECT_BY_POS)==true)Print("Close price for the order ",ticket," = ",OrderClosePrice());elsePrint("OrderSelect failed error code is",GetLastError());OrderCloseTime:Syntax:datetime OrderCloseTime( )Description:The OrderCloseTime function returns the close time of the selected order.If the return value is 0 that means the order hasn’t been closed yet otherwise it has been closed and retrieved from the history.The order must be selected by OrderSelect before calling OrderCloseTime.Parameters:This function doesn’t take any parameters and returns a datetime data type (the close time of the selected order).Example:if(OrderSelect(10,SELECT_BY_POS,MODE_HISTORY)==true){datetime ctm=OrderOpenTime();if(ctm>0) Print("Open time for the order 10 ", ctm);ctm=OrderCloseTime();if(ctm>0) Print("Close time for the order 10 ", ctm);}elsePrint("OrderSelect failed error code is",GetLastError());OrderComment:Syntax:string OrderComment( )Description:The OrderCloseTime function returns the comment string for the selected order. Note: This comment has been assigned when you opened the order with OrderSend or has been assigned by the server. Sometimes the server append its comment at the end of you comment string.The order must be selected by OrderSelect before calling OrderCloseTime. Parameters:This function doesn’t take any parameters and returns a string data type (the comment string of the selected order).Example:string comment;if(OrderSelect(10,SELECT_BY_TICKET)==false){Print("OrderSelect failed error code is",GetLastError());return(0);}comment = OrderComment();// ...OrderCommission:Syntax:double OrderCommission( )Description:The OrderCommission function returns the commission amount of the selected order. The order must be selected by OrderSelect before calling OrderCommission. Parameters:This function doesn’t take any parameters and returns a double data type (the commission amount of the selected order).Example:if(OrderSelect(10,SELECT_BY_POS)==true)Print("Commission for the order 10 ",OrderCommission());elsePrint("OrderSelect failed error code is",GetLastError());OrderExpiration:Syntax:datetime OrderExpiration( )Description:The OrderExpiration function returns the expiration time of the selected pending order that you have set in OrderSend.The order must be selected by OrderSelect before calling OrderExpiration.Parameters:This function doesn’t take any parameters and returns a datetime data type (the expiration time of the selected pending order).Example:if(OrderSelect(10, SELECT_BY_TICKET)==true)Print("Order expiration for the order #10 is ",OrderExpiration());elsePrint("OrderSelect failed error code is",GetLastError());OrderLots:Syntax:double OrderLots( )Description:The OrderLots function returns the lots value of the selected order that you have set in OrderSend (volume parameter).The order must be selected by OrderSelect before calling OrderLots. Parameters:This function doesn’t take any parameters and returns a datetime data type (the lots value of the selected order).Example:if(OrderSelect(10,SELECT_BY_POS)==true)Print("lots for the order 10 ",OrderLots());elsePrint("OrderSelect failed error code is",GetLastError());OrderMagicNumber:Syntax:int OrderMagicNumber( )Description:The OrderMagicNumber function returns the magic number of the selected order that you have set in OrderSend.The order must be selected by OrderSelect before calling OrderMagicNumber. Parameters:This function doesn’t take any parameters and returns an integer data type (the magic number of the selected order).Example:if(OrderSelect(10,SELECT_BY_POS)==true)Print("Magic number for the order 10 ", OrderMagicNumber());elsePrint("OrderSelect failed error code is",GetLastError());OrderOpenPrice:Syntax:double OrderOpenPrice( )Description:The OrderOpenPrice function returns the open price of the selected order.The order must be selected by OrderSelect before calling OrderOpenPrice. Parameters:This function doesn’t take any parameters and returns a double data type (the open price of the selected order).Example:if(OrderSelect(10, SELECT_BY_POS)==true)Print("open price for the order 10 ",OrderOpenPrice());elsePrint("OrderSelect failed error code is",GetLastError());OrderOpenTime:Syntax:datetime OrderOpenTime( )Description:The OrderOpenTime function returns the open time of the selected order.The order must be selected by OrderSelect before calling OrderOpenTime. Parameters:This function doesn’t take any parameters and returns a datetime data type (the open time of the selected order).Example:if(OrderSelect(10, SELECT_BY_POS)==true)Print("open time for the order 10 ",OrderOpenTime());elsePrint("OrderSelect failed error code is",GetLastError());OrderPrint:Syntax:void OrderPrint( )Description:The OrderPrint function prints the selected order data to the expert log file.The order must be selected by OrderSelect before calling OrderPrint. Parameters:This function doesn’t take any parameters and doesn’t return any value (void). Note: void means the function doesn’t return any value, so, you can’t assign it to a variable like this:int i = OrderPrint(); //no meaning line, although the compiler will not complain.Example:if(OrderSelect(10, SELECT_BY_TICKET)==true)OrderPrint();elsePrint("OrderSelect failed error code is",GetLastError());OrderProfit:Syntax:double OrderProfit( )Description:The OrderProfit function returns the profit of the selected order.The order must be selected by OrderSelect before calling OrderProfit. Parameters:This function doesn’t take any parameters and returns a double data type (the profit of the selected order).Example:if(OrderSelect(10, SELECT_BY_POS)==true)Print("Profit for the order 10 ",OrderProfit());elsePrint("OrderSelect failed error code is",GetLastError());OrderStopLoss:Syntax:double OrderStopLoss( )Description:The OrderStopLoss function returns the stoploss price of the selected order that you have set in OrderSend or modified with OrderModify.The order must be selected by OrderSelect before calling OrderStopLoss.Parameters:This function doesn’t take any parameters and returns a double data type (the stoplossprice of the selected order).Example:if(OrderSelect(ticket,SELECT_BY_POS)==true)Print("Stop loss value for the order 10 ", OrderStopLoss());elsePrint("OrderSelect failed error code is",GetLastError());OrdersTotal:Syntax:int OrdersTotal( )Description:The OrdersTotal function returns the number of opened and pending orders. If thisnumber is 0 that means there are no orders (market or pending ones) has been opened. Parameters:This function doesn’t take any parameters and returns an integer data type (thenumber of opened and pending orders).Example:int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");if(handle<0) return(0);// write headerFileWrite(handle,"#","open price","open time","symbol","lots");int total=OrdersTotal();// write open ordersfor(int pos=0;pos<total;pos++){if(OrderSelect(pos,SELECT_BY_POS)==false) continue;FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime(),OrderSymbol(),OrderLots()); }FileClose(handle);OrderSwap:Syntax:double OrderSwap( )Description:The OrderSwap function returns the swap value of the selected order.The order must be selected by OrderSelect before calling OrderSwap.A swap involves the exchange of principal and interest in one currency for the same in another currency. Currency swaps were originally done to get around the problem of exchange controls. ().Parameters:This function doesn’t take any parameters and returns a double data type (the swap value of the selected order).Example:if(OrderSelect(order_id, SELECT_BY_TICKET)==true)Print("Swap for the order #", order_id, " ",OrderSwap());elsePrint("OrderSelect failed error code is",GetLastError());OrderSymbol:Syntax:string OrderSymbol( )Description:The OrderSymbol function returns the string representation of currency pair of the selected order (Ex: EURUSD and USDJPY).The order must be selected by OrderSelect before calling OrderSymbol. Parameters:This function doesn’t take any parameters and returns a string data type (the string representation of currency pair of the selected order).Example:if(OrderSelect(12, SELECT_BY_POS)==true)Print("symbol of order #", OrderTicket(), " is ", OrderSymbol());elsePrint("OrderSelect failed error code is",GetLastError());OrderTakeProfit:Syntax:double OrderTakeProfit( )Description:The OrderTakeProfit function returns the takeprofit price of the selected order that you have set in OrderSend or modified with OrderModify.The order must be selected by OrderSelect before calling OrderTakeProfit. Parameters:This function doesn’t take any parameters and returns a double data type (the takeprofit price of the selected order).Example:if(OrderSelect(12, SELECT_BY_POS)==true)Print("Order #",OrderTicket()," profit: ", OrderTakeProfit());elsePrint("OrderSelect() âَ ًهë îّèلêَ- ",GetLastError());OrderTicket:Syntax:int OrderTicket( )Description:The OrderTicket function returns the ticket number of the selected order.The order must be selected by OrderSelect before calling OrderTicket.Parameters:This function doesn’t take any parameters and returns an integer data type (the ticket number of the selected order).Example:if(OrderSelect(12, SELECT_BY_POS)==true)order=OrderTicket();elsePrint("OrderSelect failed error code is",GetLastError());I hope the trading functions are clearer now.I welcome very much your questions and suggestions.Coders’ Guru20-12-2005。