Post a new post
Open the left side

MT4的订单传送函数OrderSend() introduce

[Copy Link]
907 0

Register now, make more friends, enjoy more functions, and let you play in the community easily.

You need Sign in Can be downloaded or viewed without an account?Register Now Quick login with mobile dynamic code

x
OrderSend()函数用于MQL下单语法如下:

int OrderSend(string Symbol,int Type,double Lots. double Price,
int Slippage,double StopLoss,double TakeProfit,string Comment=NULL,
int MagicNumber=0,datetime Expiration =0,color Arroi=CLR_NONE);

code(Symbol): 一个字符串,表示该货币对的交易,for exampleJPYUSD。 Symbol()函数用于当前图表的货币对。

type(Type):订单类型为买人或卖出,市场单、停损或限价单。 这是一个整数值,代表以下常量:
OP_BUY - Buy market order(integer value 0)
OP_SELL-Sell m arket order(integer value 1)
OPBUYSTOP-Buy stop order(integer value 2) .0
OPSELLSTOP - Sell stop order(integer value 3)
OP_BUYLIMIT-Buy limit order(integer value 4)
OPSELLLIMIT - Sell limit order(integer value 5)
交易手量(Lots):如果经纪商支持,则可以指定迷你手(0.1)或微型手(0.01)。
价格:当你要开单时,买人市价为市场卖价(ASK),卖出市价为市场买价(BID)。 对于挂单交易,该价格即会高于或低于目前的价格。
Sliding point(Slippage):当自动交易设定最大滑点时,如经纪商不使用该设定,即会忽略此参数。
Stop loss(StopLoss):止损价。止损价格会在多单之下或空单之上。如果设置为“0”,将不会有此交易。
停利(TakeProfit):和止损单为相反模式。 如果设置为“0”,没有获利将被使用。
注释(Comment):一个可选的字符串,将作为命令注释。注释显示在终端窗口中,根据窗口商品标签。 下单注释也可以用命令标识符。
自定义数字(MagicNumber):一个可选的整数,该数字用于EA中可进行订单辨识。 强烈建议你使用此值。
到期(Expiration):预挂单可设定到期时间。 and 非所有的经纪商都采用这种类型下单。
index(Arrow):图表上的指标可以变换颜色来表示开仓价和时间。 如果没有指定颜色,指标将无法绘制。

OrderSend()订单的函数返回。如果没有下订单,则是错误条件,返回值为“-1”。我们可以保存订单或全局变量或静态变量供以后使用。如果订单没有放在应有的地方,则会出现设定条件错误,我们可以分析错误,并根据返回的错误代码进行更正。
"Small gifts, come to Huiyi to support me"
No one has offered a reward yet. Give me some support
comiis_nologin
You need to log in before you can reply Sign in | Register Now Quick login with mobile dynamic code

Point rules of this version

more

Customer Service Center

238-168-2638 QQcustomer service Monday to Friday 20:00-24:00
Quick reply Back to top Back to list