初学者的问题 MQL5 MT5 MetaTrader 5 - 页 909 1...902903904905906907908909910911912913914915916...1503 新评论 Aleksandr Egorov 2018.08.03 17:57 #9081 Vladimir Karputov:请正确插入代码。我已经纠正了你一次,并正确地插入了代码--为什么你又要插入一张不可读的布克夫?我把它放在定型器里。 Vladimir Karputov 2018.08.03 17:58 #9082 TYRBO:弗拉基米尔,晚上好,你能不能推荐一个计算利润百分比的函数,我想计算交易量,但它不能正确工作。 顺便说一下,平仓的数量也是一个问题,要知道其中有多少人进行了交易这是我第四次正确地执行了你的代码。夜晚不再那么阴沉了! Vladimir Karputov 2018.08.03 18:00 #9083 TYRBO:把它放在定型器中。你为什么需要订单?与各行业合作。 Aleksandr Egorov 2018.08.03 18:01 #9084 Vladimir Karputov:你为什么需要订单?与各行业合作。向我解释一下,我的大脑怎么已经沸腾了? Vladimir Karputov 2018.08.03 18:08 #9085 TYRBO:说明我的大脑已经沸腾了该代码选择了从_日期 到_日期 的时间范围内的交易。 //+------------------------------------------------------------------+ //| HistoryDealGetTicket.mq5 | //| Copyright © 2016-2017, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2016-2017, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.004" #property script_show_inputs //--- input datetime from_date=D'2017.02.07 11:11:00'; input datetime to_date=D'2019.09.20 11:40:00'; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { ulong deal_ticket; // ticket deal ulong order_ticket; // deal order number datetime deal_transaction_time; // deal time long deal_type; // deal type long deal_entry; // deal entry - entry in, entry out, reverse long deal_position_ID; // identifier of a position, in the opening, modification or closing of which this deal took part string deal_description; // string to form description double deal_volume; // deal volume double deal_commission; // deal commission double deal_swap; // cumulative swap on close double deal_profit; // deal profit string deal_symbol; // deal symbol //--- request trade history HistorySelect(from_date,to_date); //--- number of deal in history int deals=HistoryDealsTotal(); //--- for all deals for(int i=0;i<deals;i++) { deal_ticket = HistoryDealGetTicket(i); deal_volume = HistoryDealGetDouble(deal_ticket,DEAL_VOLUME); deal_commission = HistoryDealGetDouble(deal_ticket,DEAL_COMMISSION); deal_swap = HistoryDealGetDouble(deal_ticket,DEAL_SWAP); deal_profit = HistoryDealGetDouble(deal_ticket,DEAL_PROFIT); deal_transaction_time= (datetime)HistoryDealGetInteger(deal_ticket,DEAL_TIME); order_ticket = HistoryDealGetInteger(deal_ticket,DEAL_ORDER); deal_type = HistoryDealGetInteger(deal_ticket,DEAL_TYPE); deal_entry = HistoryDealGetInteger(deal_ticket,DEAL_ENTRY); deal_symbol = HistoryDealGetString(deal_ticket,DEAL_SYMBOL); deal_position_ID = HistoryDealGetInteger(deal_ticket,DEAL_POSITION_ID); deal_description=GetDealDescription(deal_entry,deal_type,deal_volume,deal_commission, deal_swap,deal_profit,deal_symbol,order_ticket,deal_position_ID); //--- make beautiful formatting for number of the deal string print_index=StringFormat("% 3d",i); //--- output information on the deal Print(print_index+": deal #",deal_ticket," at ",deal_transaction_time," ",deal_description); } } //+------------------------------------------------------------------+ //| Returns the line description of operation | //+------------------------------------------------------------------+ string GetDealDescription(const long entry,const long type,const double volume,const double commission, const double swap,const double profit,const string symbol,const long ticket,const long pos_ID) { string descr; // description //--- switch((int)entry) { case DEAL_ENTRY_IN: descr="Entry in, "; break; case DEAL_ENTRY_OUT: descr="Entry out, "; break; case DEAL_ENTRY_INOUT: descr="Reverse, "; break; case DEAL_ENTRY_OUT_BY: descr="Сlose a position by an opposite one, "; break; } //--- switch((int)type) { case DEAL_TYPE_BALANCE: descr+="\"balance\""; break; case DEAL_TYPE_CREDIT: descr+="\"credit\""; break; case DEAL_TYPE_CHARGE: descr+="\"charge\""; break; case DEAL_TYPE_CORRECTION: descr+="\"correction\""; break; case DEAL_TYPE_BUY: descr+="buy"; break; case DEAL_TYPE_SELL: descr+="sell"; break; case DEAL_TYPE_BONUS: descr+="\"bonus\""; break; case DEAL_TYPE_COMMISSION: descr+="\"additional commission\""; break; case DEAL_TYPE_COMMISSION_DAILY: descr+="\"daily commission\""; break; case DEAL_TYPE_COMMISSION_MONTHLY: descr+="\"monthly commission\""; break; case DEAL_TYPE_COMMISSION_AGENT_DAILY: descr+="\"daily agent commission\""; break; case DEAL_TYPE_COMMISSION_AGENT_MONTHLY: descr+="\"monthly agent commission\""; break; case DEAL_TYPE_INTEREST: descr+="\"interest rate\""; break; case DEAL_TYPE_BUY_CANCELED: descr+="cancelled buy deal\""; break; case DEAL_TYPE_SELL_CANCELED: descr+="cancelled sell deal\""; break; } descr=StringFormat("%s vol: %G comm: %G swap: %G profit: %G %s (order #%d, position ID %d)", descr, // description volume, // deal volume commission,// deal commission swap, // cumulative swap on close profit, // deal profit symbol, // deal symbol ticket, // deal order number pos_ID // identifier of a position, in the opening, modification or closing of which this deal took part ); return(descr); //--- } //+------------------------------------------------------------------+ 并获得每个交易的信息。 deal_ticket = HistoryDealGetTicket(i); deal_volume = HistoryDealGetDouble(deal_ticket,DEAL_VOLUME); deal_commission = HistoryDealGetDouble(deal_ticket,DEAL_COMMISSION); deal_swap = HistoryDealGetDouble(deal_ticket,DEAL_SWAP); deal_profit = HistoryDealGetDouble(deal_ticket,DEAL_PROFIT); deal_transaction_time= (datetime)HistoryDealGetInteger(deal_ticket,DEAL_TIME); order_ticket = HistoryDealGetInteger(deal_ticket,DEAL_ORDER); deal_type = HistoryDealGetInteger(deal_ticket,DEAL_TYPE); deal_entry = HistoryDealGetInteger(deal_ticket,DEAL_ENTRY); deal_symbol = HistoryDealGetString(deal_ticket,DEAL_SYMBOL); deal_position_ID = HistoryDealGetInteger(deal_ticket,DEAL_POSITION_ID); 然后将其全部打印出来。 如果你有任何问题,可以在星期一问我,但现在我要去睡觉了...... 附加的文件: HistoryDealGetTicket.mq5 12 kb ISL 2018.08.07 14:49 #9086 晚上好! 请澄清一下情况。 我有一个测试者在历史上,在某一点上发生了以下情况 我的位置,如果我把数量*价格相乘,离3900还很远!"。我没有正确理解的是什么? ISL 2018.08.07 15:29 #9087 这是另一个混乱。 我完全不明白有什么问题? ISL 2018.08.07 15:33 #9088 没有肩膀。 ISL 2018.08.08 08:03 #9089 论坛用户早上好!!。 请帮助解决我的问题,我的脑袋已经开始转动了,我在哪里错过了什么? Fast235 2018.08.13 12:54 #9090 我已经有一段时间没有优化过任何东西了。 结果栏是什么意思? 我搞不清楚。 用10千的测试是 1...902903904905906907908909910911912913914915916...1503 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
请正确插入代码。我已经纠正了你一次,并正确地插入了代码--为什么你又要插入一张不可读的布克夫?
我把它放在定型器里。
弗拉基米尔,晚上好,你能不能推荐一个计算利润百分比的函数,我想计算交易量,但它不能正确工作。
顺便说一下,平仓的数量也是一个问题,要知道其中有多少人进行了交易这是我第四次正确地执行了你的代码。夜晚不再那么阴沉了!
把它放在定型器中。
你为什么需要订单?与各行业合作。
你为什么需要订单?与各行业合作。
向我解释一下,我的大脑怎么已经沸腾了?
说明我的大脑已经沸腾了
该代码选择了从_日期 到_日期 的时间范围内的交易。
并获得每个交易的信息。
然后将其全部打印出来。
如果你有任何问题,可以在星期一问我,但现在我要去睡觉了......
晚上好!
请澄清一下情况。
我有一个测试者在历史上,在某一点上发生了以下情况
我的位置,如果我把数量*价格相乘,离3900还很远!"。我没有正确理解的是什么?
这是另一个混乱。
我完全不明白有什么问题?
论坛用户早上好!!。
请帮助解决我的问题,我的脑袋已经开始转动了,我在哪里错过了什么?
我已经有一段时间没有优化过任何东西了。
结果栏是什么意思? 我搞不清楚。
用10千的测试是