如何检查一个订单是否被选中 - 页 12 1...567891011121314151617181920 新评论 Алексей Тарабанов 2013.02.22 22:13 #111 grell: 所以这就是我的观点。我的职能部门没有通用性,每个部门都严格地致力于自己的业务。甚至买和卖也是分开的。因此,让订单号改变,让停顿点爬升,但门票和魔术师将保持不变。 好吧,你对slosoll得意忘形了:) Дмитрий 2013.02.22 22:15 #112 tara: 好吧,你被打得晕头转向了:) 还没有出现过失误。在这方面我是个暴君:) Boris 2013.02.22 22:16 #113 tara: 不,不是像黄油中的奶酪,但我作为一名中校做了我该做的事。对不起,如果我冒犯了你 :( 不,不要被冒犯,如果我说错了什么,也不要有什么义务,而是真诚地。:) Алексей Тарабанов 2013.02.22 22:16 #114 borilunad: 不,没有理由被冒犯,如果我说错了话,你不必答应,但要真诚地答应。:) 不要紧。 Рустам 2013.02.22 22:21 #115 Ant_TL:你完全误解了我。出于某种原因,一半的人也是如此。我不需要在函数B()中处理那个订单,它是在函数A()中选择的。函数B()对其他 订单起作用,不管是哪个订单,它与函数A()无关;函数B()有自己的逻辑。它可以计算订单的数量,他们的总利润,查看他们的评论,TP SL,等等。任务是要从函数B()返回到函数A(),这样无论函数B()对订单做了什么,在从它调用函数B()时,函数A()的操作逻辑不会被违反,因为在调用函数B()之前,函数A()选择的订单不再被选择,选择的订单是由函数B()处理的另一个随机订单,很可能也在循环中搜索订单。 你一直忘了在任何时候只能 选择一个订单。Exit = 将订单列表存储在一个储蓄池中(你的数组)。一个全局变量 lastorder是不够的。一个更好的选择是lastords[ticket][function]。 Рустам 2013.02.22 22:22 #116 //+------------------------------------------------------------------+ //| Description included Functions | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| ORDERS.mq4 | //| Copyright © 2012. XrustSolution. mail:xrustx@gmail.com | //| https://www.youtube.com/user/opmlv http://forexrust.info | //+------------------------------------------------------------------+ #property copyright "Copyright © 2012. XrustSolution. mail:xrustx@gmail.com" #property link "https://www.youtube.com/user/opmlv http://forexrust.info" //+------------------------------------------------------------------+ //| Defines and Exports and Includes | //+------------------------------------------------------------------+ #define ORDS_TOTAL 100 #define HIST_TOTAL 100000 //+------------------------------------------------------------------+ //| Orders Property Indexes | //+------------------------------------------------------------------+ #define ORD_TICK 0 #define ORD_LOTS 1 #define ORD_OPTM 2 #define ORD_OPPR 3 #define ORD_STOP 4 #define ORD_TAKE 5 #define ORD_CLPR 6 #define ORD_CLTM 7 #define ORD_PROF 8 #define ORD_SWAP 9 #define ORD_COMM 10 #define ORD_EXPR 11 #define ORD_SYMB 12 #define ORD_COMN 13 //+------------------------------------------------------------------+ //| Extern and Global variables | //+---externs--------------------------------------------------------+ //+---globals--------------------------------------------------------+ int gOrdsTotal[7]; // number open orders int gOrdsTicks[ORDS_TOTAL][6]; // array of open ords tickets double gOrdsProps[ORDS_TOTAL][6][12]; // array of open ords properties double gPreOrdsProps[ORDS_TOTAL][6][12]; double gOrdsPrf[6]; // open ords summary profit for order types double gOrdsLts[6]; // open ords summary lots for order types //+------------------------------------------------------------------+ int gHistTotal[7]; // number closed orders int gHistTicks[HIST_TOTAL][6]; // array of closed ords tickets double gHistProps[HIST_TOTAL][6][12]; // array of closed ords properties double gHistPrf[6]; // closed ords summary profit for order types double gHistLts[6]; // closed ords summary lots for order types //+------------------------------------------------------------------+ //| Function : double iOrdProps(OrderType,PropIndex,Count) | //+------------------------------------------------------------------+ double iOrdProps(int type,int indx,int co){int i;double res=0; i = gOrdsTicks[co][type]; if(OrderSelect(i,SELECT_BY_TICKET)){ if(OrderCloseTime()==0){ switch(indx){ case ORD_TICK : res = OrderTicket(); break; case ORD_LOTS : res = OrderLots(); break; case ORD_OPTM : res = OrderOpenTime(); break; case ORD_OPPR : res = OrderOpenPrice(); break; case ORD_STOP : res = OrderStopLoss(); break; case ORD_TAKE : res = OrderTakeProfit(); break; case ORD_CLPR : res = OrderClosePrice(); break; case ORD_CLTM : res = OrderCloseTime(); break; case ORD_PROF : res = OrderProfit(); break; case ORD_SWAP : res = OrderSwap(); break; case ORD_COMM : res = OrderCommission(); break; case ORD_EXPR : res = OrderExpiration(); break; default: res = 0; break; } } }else{ return(EMPTY_VALUE); } return(res); } //+------------------------------------------------------------------+ //| Function : double fOrdProps(OrderType,PropIndex,Count) | //+------------------------------------------------------------------+ double fOrdProps(int type,int indx,int co){return(gOrdsProps[co][type][indx]);} //+------------------------------------------------------------------+ //| Function : int fOrdsTicket(OrderType,Count) | //+------------------------------------------------------------------+ int fOrdsTicket(int type, int indx = 0){return(gOrdsTicks[indx][type]);} //+------------------------------------------------------------------+ //| Function : int fOrdsTotal(OrderType) | //+------------------------------------------------------------------+ int fOrdsTotal(int type = 6){return(gOrdsTotal[type]);} //+------------------------------------------------------------------+ //| Function : double fHistProps(OrderType,PropIndex,Count) | //+------------------------------------------------------------------+ double fHistProps(int type,int indx,int co){return(gOrdsProps[co][type][indx]);} //+------------------------------------------------------------------+ //| Function : int fHistTicket(OrderType,Count) | //+------------------------------------------------------------------+ int fHistTicket(int type, int indx = 0){return(gHistTicks[indx][type]);} //+------------------------------------------------------------------+ //| Function : int fHistTotal(OrderType) | //+------------------------------------------------------------------+ int fHistTotal(int type = 6){return(gOrdsTotal[type]);} //+------------------------------------------------------------------+ //| Function : int HistRefresh(Magik,Comment,Symbol) | //| Copyright © 2012, XrustSolution. mail:xrustx@gmail.com | //| https://www.youtube.com/user/opmlv http://forexrust.info | //+------------------------------------------------------------------+ //| Description: | //+------------------------------------------------------------------+ int HistRefresh(int mn=-1,string comm="",string sy=""){int i,ii=0,type;bool iMn=true,iComm=true; if(mn<0){iMn=false;} ArrayResize(gHistTotal,7); ArrayInitialize(gHistTotal,0); ArrayResize(gHistProps,ORDS_TOTAL); ArrayInitialize(gHistProps,0); ArrayResize(gHistPrf,ORDS_TOTAL); ArrayInitialize(gHistPrf,0); ArrayResize(gHistLts,ORDS_TOTAL); ArrayInitialize(gHistLts,0); if(StringLen(comm)<1){iComm=false;} for(i = OrdersHistoryTotal()-1; i>=0; i--){ if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){ if(OrderType()>5){continue;} if(OrderCloseTime()==0){continue;} if(sy!=""){if(OrderSymbol()!=sy){continue;}} if(iMn){if(OrderMagicNumber()!=mn){continue;}} if(iComm){if(StringFind(OrderComment(),comm)<0){continue;}} type = OrderType(); gHistProps[gHistTotal[type]][type][0] = OrderTicket(); gHistProps[gHistTotal[type]][type][1] = OrderLots(); gHistProps[gHistTotal[type]][type][2] = OrderOpenTime(); gHistProps[gHistTotal[type]][type][3] = OrderOpenPrice(); gHistProps[gHistTotal[type]][type][4] = OrderStopLoss(); gHistProps[gHistTotal[type]][type][5] = OrderTakeProfit(); gHistProps[gHistTotal[type]][type][6] = OrderClosePrice(); gHistProps[gHistTotal[type]][type][7] = OrderCloseTime(); gHistProps[gHistTotal[type]][type][8] = OrderProfit(); gHistProps[gHistTotal[type]][type][9] = OrderSwap(); gHistProps[gHistTotal[type]][type][10] = OrderCommission(); gHistProps[gHistTotal[type]][type][11] = OrderExpiration(); gHistPrf[type] += OrderProfit()+OrderSwap()+OrderCommission(); gHistLts[type] += OrderLots(); gHistTotal[type]++;// count for ordertypes gHistTotal[6]++;// all orders count ii++; } } return(ii); } //+------------------------------------------------------------------+ //| Function : int OrdsRefresh(Magik,Comment,Symbol) | //| Copyright © 2012, XrustSolution. mail:xrustx@gmail.com | //| https://www.youtube.com/user/opmlv http://forexrust.info | //+------------------------------------------------------------------+ //| Description: | //+------------------------------------------------------------------+ int OrdsRefresh(int mn=-1,string comm="",string sy=""){int i,ii=0,type;bool iMn=true,iComm=true; if(mn<0){iMn=false;} if(StringLen(comm)<1){iComm=false;} ArrayResize(gOrdsTotal,7); ArrayInitialize(gOrdsTotal,0); ArrayResize(gOrdsTicks,ORDS_TOTAL); ArrayInitialize(gOrdsTicks,0); ArrayResize(gOrdsProps,ORDS_TOTAL); ArrayInitialize(gOrdsProps,0); ArrayResize(gOrdsPrf,ORDS_TOTAL); ArrayInitialize(gOrdsPrf,0); ArrayResize(gOrdsLts,ORDS_TOTAL); ArrayInitialize(gOrdsLts,0); for(i = OrdersTotal()-1; i>=0; i--){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ if(OrderType()>5){continue;} if(OrderCloseTime()!=0){continue;} if(sy!=""){if(OrderSymbol()!=sy){continue;}} if(iMn){if(OrderMagicNumber()!=mn){continue;}} if(iComm){if(StringFind(OrderComment(),comm)<0){continue;}} type = OrderType(); gOrdsTicks[gOrdsTotal[type]][type] = OrderTicket(); gOrdsProps[gOrdsTotal[type]][type][0] = OrderTicket(); gOrdsProps[gOrdsTotal[type]][type][1] = OrderLots(); gOrdsProps[gOrdsTotal[type]][type][2] = OrderOpenTime(); gOrdsProps[gOrdsTotal[type]][type][3] = OrderOpenPrice(); gOrdsProps[gOrdsTotal[type]][type][4] = OrderStopLoss(); gOrdsProps[gOrdsTotal[type]][type][5] = OrderTakeProfit(); gOrdsProps[gOrdsTotal[type]][type][6] = OrderClosePrice(); gOrdsProps[gOrdsTotal[type]][type][7] = OrderCloseTime(); gOrdsProps[gOrdsTotal[type]][type][8] = OrderProfit(); gOrdsProps[gOrdsTotal[type]][type][9] = OrderSwap(); gOrdsProps[gOrdsTotal[type]][type][10] = OrderCommission(); gOrdsProps[gOrdsTotal[type]][type][11] = OrderExpiration(); gOrdsPrf[type] += OrderProfit()+OrderSwap()+OrderCommission(); gOrdsLts[type] += OrderLots(); gOrdsTotal[type]++;// count for ordertypes gOrdsTotal[6]++;// all orders count ii++; } } return(ii); } //+------------------------------------------------------------------+ Алексей Тарабанов 2013.02.22 22:25 #117 鲁斯塔姆,谢谢你,节日快乐。 Рустам 2013.02.22 22:27 #118 是的,也祝你节日快乐!每个人都有一百克的量 :) Ilya Malev 2013.02.22 22:33 #119 TarasBY:在我的代码中,这个错误不会发生,因为这个函数是在OrderSelect()之后调用的。而代码中的检查是在没有所有可执行的EA功能的共同结构的情况下编写代码的时代留下的。此外,我的大多数函数都包含错误处理函数,我非常小心地避免它们。而且还有一些功能会产生错误,比如你要找的答案:"先前选定的订单,还是没有?"顺便说一下,我记得在使用编译库中的OrderSelect()函数时有一个特点(可能对某人有用):我们已经选择了一个订单(如何选择--主要不是),OrderTicket()--返回所选订单的数量。但是,如果我们想从位于编译库中的函数中获得这个所选订单的属性,我们将一无所获。我们必须再次选择该订单(再次)。事实上,我遇到的情况是,错误是由一个通用函数引起的,该函数既可以在订单处理循环中使用,也可以在这些循环之外使用,即在订单被选中之前使用,这导致了错误。如果我们想让通用服务功能与订单一起工作,既可以在选择订单之后,也可以在之前使用,既可以在有未结订单时使用,也可以在没有订单时使用,我们应该使用像我引用的机制来确保我们不会出现这种错误。我已经在这个主题的早些时候写了关于订单选择 没有被传递到库模块和返回的事实。 Дмитрий 2013.02.22 22:36 #120 Ant_TL:事实上,我遇到的情况是,错误是由一个通用函数引起的,这个函数在订单处理周期内外都可以使用,也就是在选择订单之前,引起错误。如果我们想制作对订单起作用的通用服务功能,并且在选择订单后和之前都可以使用,在有未结订单和没有订单时都可以使用,我们应该使用我在上一页提到的这种机制来避免这个错误。我已经在这个主题的早些时候写了关于订单选择没有被传递到库模块和返回的事实。 你应该习惯每个交易操作 都有自己的选择顺序,你就不会有任何问题。而且,是的,你已经正确地写了,只能选择一个订单。其他一切都由数组来解决。 1...567891011121314151617181920 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
所以这就是我的观点。我的职能部门没有通用性,每个部门都严格地致力于自己的业务。甚至买和卖也是分开的。因此,让订单号改变,让停顿点爬升,但门票和魔术师将保持不变。
好吧,你对slosoll得意忘形了:)
好吧,你被打得晕头转向了:)
还没有出现过失误。在这方面我是个暴君:)
不,不是像黄油中的奶酪,但我作为一名中校做了我该做的事。对不起,如果我冒犯了你 :(
不,没有理由被冒犯,如果我说错了话,你不必答应,但要真诚地答应。:)
你完全误解了我。出于某种原因,一半的人也是如此。我不需要在函数B()中处理那个订单,它是在函数A()中选择的。函数B()对其他 订单起作用,不管是哪个订单,它与函数A()无关;函数B()有自己的逻辑。它可以计算订单的数量,他们的总利润,查看他们的评论,TP SL,等等。任务是要从函数B()返回到函数A(),这样无论函数B()对订单做了什么,在从它调用函数B()时,函数A()的操作逻辑不会被违反,因为在调用函数B()之前,函数A()选择的订单不再被选择,选择的订单是由函数B()处理的另一个随机订单,很可能也在循环中搜索订单。
你一直忘了在任何时候只能 选择一个订单。Exit = 将订单列表存储在一个储蓄池中(你的数组)。一个全局变量 lastorder是不够的。一个更好的选择是lastords[ticket][function]。
在我的代码中,这个错误不会发生,因为这个函数是在OrderSelect()之后调用的。而代码中的检查是在没有所有可执行的EA功能的共同结构的情况下编写代码的时代留下的。
此外,我的大多数函数都包含错误处理函数,我非常小心地避免它们。而且还有一些功能会产生错误,比如你要找的答案:"先前选定的订单,还是没有?"
顺便说一下,我记得在使用编译库中的OrderSelect()函数时有一个特点(可能对某人有用):我们已经选择了一个订单(如何选择--主要不是),OrderTicket()--返回所选订单的数量。但是,如果我们想从位于编译库中的函数中获得这个所选订单的属性,我们将一无所获。我们必须再次选择该订单(再次)。
事实上,我遇到的情况是,错误是由一个通用函数引起的,该函数既可以在订单处理循环中使用,也可以在这些循环之外使用,即在订单被选中之前使用,这导致了错误。如果我们想让通用服务功能与订单一起工作,既可以在选择订单之后,也可以在之前使用,既可以在有未结订单时使用,也可以在没有订单时使用,我们应该使用像我引用的机制来确保我们不会出现这种错误。
我已经在这个主题的早些时候写了关于订单选择 没有被传递到库模块和返回的事实。
事实上,我遇到的情况是,错误是由一个通用函数引起的,这个函数在订单处理周期内外都可以使用,也就是在选择订单之前,引起错误。如果我们想制作对订单起作用的通用服务功能,并且在选择订单后和之前都可以使用,在有未结订单和没有订单时都可以使用,我们应该使用我在上一页提到的这种机制来避免这个错误。
我已经在这个主题的早些时候写了关于订单选择没有被传递到库模块和返回的事实。
你应该习惯每个交易操作 都有自己的选择顺序,你就不会有任何问题。而且,是的,你已经正确地写了,只能选择一个订单。其他一切都由数组来解决。