我三个月前写的EA现在不能通过策略测试,但它在两三个月前运行得很好!!。 - 页 3 1234 新评论 Alain Verleyen 2014.11.30 16:56 #21 关于交易、自动交易系统和测试交易策略的论坛 angevoyageur, 2014.02.11 17:59 你好。 发布代码时请使用SRC按钮。谢谢你。 这一次,我为你编辑了它。 Alain Verleyen 2014.11.30 17:18 #22 jitanic:尊敬的客户 发送订单在模拟账户 中有效,但在真实账户中不工作(2014.11.30 18:21:00.062 55 (اخابر,D1) BuyA: error 4756, retcode = 10006)你为什么要用这样的符号,这很难理解。 request.action=5; request.type=6; request.type_filling=2;用这个来代替。 request.action=TRADE_ACTION_PENDING; request.type=ORDER_TYPE_BUY_STOP_LIMIT; request.type_filling=ORDER_FILLING_RETURN; 顺便说一下,无论哪种情况,对我来说都是有效的。 jitanic 2014.11.30 18:15 #23 我很抱歉请检查 这个脚本,并告诉我我的错误。#property description "Expert Advisor for sending trade requests " " using OrderSendAsync() function.\r\n" #property description "Handling trading events using" " OnTrade() and OnTradeTransaction() handler functions is displayed\r\n" #property description "Expert Advisor parameters allow setting Magic Number" " (unique ID) " #property description "and the mode of displaying messages in Experts log. All details are displayed by default.\r\n" input int MagicNumber=1234567; // Expert Advisor ID input bool DescriptionModeFull=true; // Detailed output mode input double Price=2652; input double Volume=1000; input double stoplimit=2681; input double sl=1000; input double tp=2681; //+------------------------------------------------------------------+ int OnInit() { //--- check if autotrading is allowed if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) { Alert("Autotrading in the terminal is disabled, Expert Advisor will be removed."); ExpertRemove(); //-- return(-1); } CreateBuySellButtons(); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ObjectDelete(0,"Buy"); ObjectDelete(0,"Sell"); ObjectDelete(0,"HALL"); } //+------------------------------------------------------------------+ void OnTradeTransaction(const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result) { } //+------------------------------------------------------------------+ void OnTrade() { } //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- handling CHARTEVENT_CLICK event ("Clicking the chart") if(id==CHARTEVENT_OBJECT_CLICK) { //--- if "Buy" button is pressed, then buy if(sparam=="Buy") { BuyA(Volume); //--- unpress the button ObjectSetInteger(0,"Buy",OBJPROP_STATE,false); } //--- if "Sell" button is pressed, then sell if(sparam=="Sell") { SellA(Volume); //--- unpress the button ObjectSetInteger(0,"Sell",OBJPROP_STATE,false); } ChartRedraw(); } } //+------------------------------------------------------------------+ void CreateBuySellButtons() { ObjectCreate(0,"Buy",OBJ_BUTTON,0,0,0); // create "Buy" button ObjectSetInteger(0,"Buy",OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetInteger(0,"Buy",OBJPROP_XDISTANCE,100); ObjectSetInteger(0,"Buy",OBJPROP_YDISTANCE,50); ObjectSetInteger(0,"Buy",OBJPROP_XSIZE,70); ObjectSetInteger(0,"Buy",OBJPROP_YSIZE,30); ObjectSetString(0,"Buy",OBJPROP_TEXT,"Buy"); ObjectSetInteger(0,"Buy",OBJPROP_COLOR,clrRed); ObjectCreate(0,"Sell",OBJ_BUTTON,0,0,0); // create "Sell" button ObjectSetInteger(0,"Sell",OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetInteger(0,"Sell",OBJPROP_XDISTANCE,100); ObjectSetInteger(0,"Sell",OBJPROP_YDISTANCE,100); ObjectSetInteger(0,"Sell",OBJPROP_XSIZE,70); ObjectSetInteger(0,"Sell",OBJPROP_YSIZE,30); ObjectSetString(0,"Sell",OBJPROP_TEXT,"Sell"); ObjectSetInteger(0,"Sell",OBJPROP_COLOR,clrBlue); ObjectCreate(0,"HALL",OBJ_LABEL,0,0,0); // create LABEL ObjectSetInteger(0,"HALL",OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetInteger(0,"HALL",OBJPROP_XDISTANCE,100); ObjectSetInteger(0,"HALL",OBJPROP_YDISTANCE,150); ObjectSetInteger(0,"HALL",OBJPROP_XSIZE,70); ObjectSetInteger(0,"HALL",OBJPROP_YSIZE,30); ObjectSetString(0,"HALL",OBJPROP_TEXT,_Symbol); ObjectSetInteger(0,"HALL",OBJPROP_COLOR,clrBlue); ChartRedraw(); } //+------------------------------------------------------------------+ void BuyA(double volume) { //--- prepare the request MqlTradeRequest request; MqlTradeResult result; MqlTradeCheckResult check; ZeroMemory(request); ZeroMemory(result); ZeroMemory(check); request.action=TRADE_ACTION_PENDING; request.symbol=_Symbol; request.volume=1000.00; request.price=2652.000; request.stoplimit=2652.000; request.sl=0; request.tp=0; request.type=ORDER_TYPE_BUY_STOP_LIMIT; request.type_filling=ORDER_FILLING_RETURN; request.type_time=0; request.expiration=0; request.magic=0; request.comment=""; if(!OrderSend(request,result)) { Print(__FUNCTION__,": error ",GetLastError(),", retcode = ",result.retcode); } //--- } //+------------------------------------------------------------------+ void SellA(double volume) { //--- prepare the request MqlTradeRequest request; request.action=TRADE_ACTION_DEAL; request.symbol=_Symbol; request.magic=0; request.volume=Volume; request.type=ORDER_TYPE_SELL; request.price=SymbolInfoDouble(request.symbol,SYMBOL_BID); request.deviation=10; request.comment="Sell using OrderSendAsync()"; MqlTradeResult result; if(!OrderSendAsync(request,result)) { Print(__FUNCTION__,": error ",GetLastError(),", retcode = ",result.retcode); } } //+------------------------------------------------------------------+ Alain Verleyen 2014.11.30 18:51 #24 jitanic:我很抱歉请检查这个脚本,并告诉我我的错误。 它对我有用。我使用TadbirTrader-Server来测试它。 jitanic 2014.11.30 18:57 #25 angevoyageur: 它对我来说是有效的。我使用TadbirTrader-Server来测试它。 你有真实账户还是在模拟账户 中查看? Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties www.mql5.com Standard Constants, Enumerations and Structures / Environment State / Account Properties - Reference on algorithmic/automated trading language for MetaTrader 5 Alain Verleyen 2014.11.30 19:19 #26 jitanic: 你有真实账户还是在模拟账户 中检查?只有模拟账户。P.S: 对不起,我忽略了一点,那就是它在你的模拟账户上也是有效的。在你的真实账户上,.NET的返回值是多少? printf("expiration=%i",SymbolInfoInteger(_Symbol,SYMBOL_EXPIRATION_MODE)); printf("filling=%i",SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE)); jitanic 2014.11.30 20:35 #27 它在演示中对我来说是有效的。它可能受到服务器的限制吗? Alain Verleyen 2014.11.30 20:38 #28 jitanic:它在演示中对我来说是有效的。它可能受到服务器的限制吗?很明显,有什么东西限制了你下这个挂单。可能是真实账户中对这个符号的设置不同(见我之前的帖子)。错误10006:请求被拒绝,这不是非常有用的信息。你尝试下了多少次这个订单? 模拟账户 的当前买入价/卖出价/最后买入价是2638/2652/2640,在真实账户上也是这样吗? jitanic 2014.12.01 12:44 #29 angevoyageur:显然有什么东西限制了你下这个挂单。可能是在真实账户上对这个符号有一些不同的设置(见我之前的帖子)。错误10006:请求被拒绝,这不是非常有用的信息。你尝试下了多少次这个订单? 模拟账户 的当前买入价/卖出价/最后买入价是2638/2652/2640,在真实账户上也是这样吗?嗨,谢谢你的答复我附上了符号属性的图片如果没有帮助,请告诉我:在我的代码中哪里可以插入打印订单? 附加的文件: Untitled.png 47 kb Alain Verleyen 2014.12.01 12:53 #30 jitanic:嗨,谢谢你的答复我附上了符号属性的图片如果没有帮助,请告诉我:在我的代码中在哪里插入打印顺序?我不明白为什么它不能工作。你现在能再试一次吗?还是不行吗? 1234 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
关于交易、自动交易系统和测试交易策略的论坛
angevoyageur, 2014.02.11 17:59
你好。
发布代码时请使用SRC按钮。谢谢你。
这一次,我为你编辑了它。
尊敬的客户
发送订单在模拟账户 中有效,但在真实账户中不工作(2014.11.30 18:21:00.062 55 (اخابر,D1) BuyA: error 4756, retcode = 10006)
你为什么要用这样的符号,这很难理解。
用这个来代替。
顺便说一下,无论哪种情况,对我来说都是有效的。
我很抱歉
请检查 这个脚本,并告诉我我的错误。
我很抱歉
请检查这个脚本,并告诉我我的错误。
它对我来说是有效的。我使用TadbirTrader-Server来测试它。
你有真实账户还是在模拟账户 中检查?
只有模拟账户。
P.S: 对不起,我忽略了一点,那就是它在你的模拟账户上也是有效的。
在你的真实账户上,.NET的返回值是多少?
它在演示中对我来说是有效的。
它可能受到服务器的限制吗?
它在演示中对我来说是有效的。
它可能受到服务器的限制吗?
很明显,有什么东西限制了你下这个挂单。可能是真实账户中对这个符号的设置不同(见我之前的帖子)。
错误10006:请求被拒绝,这不是非常有用的信息。你尝试下了多少次这个订单?
模拟账户 的当前买入价/卖出价/最后买入价是2638/2652/2640,在真实账户上也是这样吗?
显然有什么东西限制了你下这个挂单。可能是在真实账户上对这个符号有一些不同的设置(见我之前的帖子)。
错误10006:请求被拒绝,这不是非常有用的信息。你尝试下了多少次这个订单?
模拟账户 的当前买入价/卖出价/最后买入价是2638/2652/2640,在真实账户上也是这样吗?
嗨,谢谢你的答复
我附上了符号属性的图片
如果没有帮助,请告诉我:在我的代码中哪里可以插入打印订单?
嗨,谢谢你的答复
我附上了符号属性的图片
如果没有帮助,请告诉我:在我的代码中在哪里插入打印顺序?
我不明白为什么它不能工作。
你现在能再试一次吗?还是不行吗?