"不是所有的控制路径都会返回一个值 "错误 - 页 2 1234 新评论 Cristobal Giron 2018.07.16 13:29 #11 朋友们好,我有同样的问题,谁能帮帮我? double price; int slippage; double p = prce; int maxtry = RequoteAttempts; color CloseColor; OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); int ordtype = OrderType(); if (ordtype == OP_BUY) {price = NormalizeDouble(Bid,Digits); CloseColor = CloseBuyColor;} if (ordtype == OP_SELL) {price = NormalizeDouble(Ask,Digits); CloseColor = CloseSellColor;} if (MathAbs(OrderTakeProfit() - price) <= MarketInfo(Symbol(),MODE_FREEZELEVEL) * Point) return(0); if (MathAbs(OrderStopLoss() - price) <= MarketInfo(Symbol(),MODE_FREEZELEVEL) * Point) return(0); if (OrderClose(ticket,OrderLots(),price,CloseSlippage,CloseColor)) return(1); if ((GetLastError() != 135) && (GetLastError() != 138) && (GetLastError() != 146)) return(0); Print("Requote"); //--- RequoteAttempts) for (int attempt = 1; attempt <= maxtry; attempt++) { RefreshRates(); if (ordtype == OP_BUY) { slippage = MathRound((Bid - p) / pp); if (Bid >= p) { Print("Closing order. Attempt " + (attempt + 1)); if (OrderClose(ticket,OrderLots(),NormalizeDouble(Bid,Digits),slippage,CloseColor)) return(1); if (!((GetLastError() != 135) && (GetLastError() != 138) && (GetLastError() != 146))) continue; return(0); } } if (ordtype == OP_SELL) { slippage = MathRound((p - Ask) / pp); if (p >= Ask) { Print("Closing order. Attempt " + (attempt + 1)); if (OrderClose(ticket,OrderLots(),NormalizeDouble(Ask,Digits),slippage,CloseColor)) return(1); if ((GetLastError() != 135) && (GetLastError() != 138) && (GetLastError() != 146)) return(0); } } } } Keith Watford 2018.07.16 15:39 #12 复制并粘贴相关代码。从你的图片来看,你没有显示函数 的开头,所以我们不知道它应该返回什么。 无论如何,在函数的结尾需要有一个返回。 William Roeder 2018.07.16 18:37 #13 请在本论坛上用英语发帖。如果需要,请使用自动翻译工具。在使用机械翻译 时,请使用简单的语言结构。 请不要发布代码的图片。 当你发布代码时,请使用代码按钮(Alt-S)!(对于大量的代码,请附上。 )请编辑 你的(原始)帖子。论坛的一般规则和最佳做法。-一般 - MQL5编程论坛信息编辑 Cristobal Giron 2018.07.16 20:01 #14 谢谢,对不起,都修好了 Cristobal Giron 2018.07.17 11:43 #15 Keith Watford:复制并挂上相关的文件。从他的图像来看,没有显示出功能 的开始,因此不知道该如何释放。 无论哪种方式,都应该在功能的最后阶段有一个下放。你好,朋友,你现在能看到这个代码的问题了吗? JermyRec 2018.07.17 12:27 #16 if(OrderSelect... Cristobal Giron 2018.07.17 12:34 #17 JermyRec: 我不明白朋友 Keith Watford 2018.07.18 16:56 #18 int CloseOrder(int ticket, double prce){ //+--------------------------------------------------------------------------------------------------------------+ double price; int slippage; double p = prce; int maxtry = RequoteAttempts; color CloseColor; OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); int ordtype = OrderType(); if (ordtype == OP_BUY) {price = NormalizeDouble(Bid,Digits); CloseColor = CloseBuyColor;} if (ordtype == OP_SELL) {price = NormalizeDouble(Ask,Digits); CloseColor = CloseSellColor;} if (MathAbs(OrderTakeProfit() - price) <= MarketInfo(Symbol(),MODE_FREEZELEVEL) * Point) return(0); if (MathAbs(OrderStopLoss() - price) <= MarketInfo(Symbol(),MODE_FREEZELEVEL) * Point) return(0); if (OrderClose(ticket,OrderLots(),price,CloseSlippage,CloseColor)) return(1); if ((GetLastError() != 135) && (GetLastError() != 138) && (GetLastError() != 146)) return(0); Print("Requote"); //--- RequoteAttempts) for (int attempt = 1; attempt <= maxtry; attempt++) { RefreshRates(); if (ordtype == OP_BUY) { slippage = MathRound((Bid - p) / pp); if (Bid >= p) { Print("Closing order. Attempt " + (attempt + 1)); if (OrderClose(ticket,OrderLots(),NormalizeDouble(Bid,Digits),slippage,CloseColor)) return(1); if (!((GetLastError() != 135) && (GetLastError() != 138) && (GetLastError() != 146))) continue; return(0); } } if (ordtype == OP_SELL) { slippage = MathRound((p - Ask) / pp); if (p >= Ask) { Print("Closing order. Attempt " + (attempt + 1)); if (OrderClose(ticket,OrderLots(),NormalizeDouble(Ask,Digits),slippage,CloseColor)) return(1); if ((GetLastError() != 135) && (GetLastError() != 138) && (GetLastError() != 146)) return(0); } } } } In this line would be the error (')' - not all control paths return to value)主持人:从另一个主题复制过来的 Keith Watford 2018.07.18 17:01 #19 int CloseOrder( int ticket, double prce){ //+--------------------------------------------------------------------------------------------------------------+ double price; int slippage; double p = prce; int maxtry = RequoteAttempts; color CloseColor; OrderSelect (ticket, SELECT_BY_TICKET , MODE_TRADES ); int ordtype = OrderType (); if (ordtype == OP_BUY ) {price = NormalizeDouble ( Bid , Digits ); CloseColor = CloseBuyColor;} if (ordtype == OP_SELL ) {price = NormalizeDouble ( Ask , Digits ); CloseColor = CloseSellColor;} if ( MathAbs ( OrderTakeProfit () - price) <= MarketInfo ( Symbol (), MODE_FREEZELEVEL ) * Point ) return ( 0 ); if ( MathAbs ( OrderStopLoss () - price) <= MarketInfo ( Symbol (), MODE_FREEZELEVEL ) * Point ) return ( 0 ); if ( OrderClose (ticket, OrderLots (),price,CloseSlippage,CloseColor)) return ( 1 ); if (( GetLastError () != 135 ) && ( GetLastError () != 138 ) && ( GetLastError () != 146 )) return ( 0 ); Print ( "Requote" ); //--- RequoteAttempts) for ( int attempt = 1 ; attempt <= maxtry; attempt++) { RefreshRates (); if (ordtype == OP_BUY ) { slippage = MathRound (( Bid - p) / pp); if ( Bid >= p) { Print ( "Closing order. Attempt " + (attempt + 1 )); if ( OrderClose (ticket, OrderLots (), NormalizeDouble ( Bid , Digits ),slippage,CloseColor)) return ( 1 ); if (!(( GetLastError () != 135 ) && ( GetLastError () != 138 ) && ( GetLastError () != 146 ))) continue ; return ( 0 ); } } if (ordtype == OP_SELL ) { slippage = MathRound ((p - Ask ) / pp); if (p >= Ask ) { Print ( "Closing order. Attempt " + (attempt + 1 )); if ( OrderClose (ticket, OrderLots (), NormalizeDouble ( Ask , Digits ),slippage,CloseColor)) return ( 1 ); if (( GetLastError () != 135 ) && ( GetLastError () != 138 ) && ( GetLastError () != 146 )) return ( 0 ); } } } return(-1);/// not all branching code in the function return values } 主持人:维塔利-阿纳涅夫 的答复是从其他主题中复制的 Keith Watford 2018.07.18 17:04 #20 请不要重复发帖。你在这里得到了回复,所以为什么要用完全相同的主题开一个新的话题。这是很自私的做法,浪费了试图帮助你的人的时间。 我已经删除了你的其他主题。 1234 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
朋友们好,我有同样的问题,谁能帮帮我?
复制并粘贴相关代码。从你的图片来看,你没有显示函数 的开头,所以我们不知道它应该返回什么。
无论如何,在函数的结尾需要有一个返回。
论坛的一般规则和最佳做法。-一般 - MQL5编程论坛
信息编辑
复制并挂上相关的文件。从他的图像来看,没有显示出功能 的开始,因此不知道该如何释放。
无论哪种方式,都应该在功能的最后阶段有一个下放。
你好,朋友,你现在能看到这个代码的问题了吗?
if(OrderSelect...我不明白朋友
主持人:从另一个主题复制过来的
主持人:维塔利-阿纳涅夫 的答复是从其他主题中复制的
请不要重复发帖。你在这里得到了回复,所以为什么要用完全相同的主题开一个新的话题。这是很自私的做法,浪费了试图帮助你的人的时间。
我已经删除了你的其他主题。