[存档]任何菜鸟问题,为了不使论坛变得杂乱无章。专业人士,不要与它擦肩而过。没有你,哪里都不能去 - 5. - 页 351 1...344345346347348349350351352353354355356357358...432 新评论 --- 2013.05.21 06:13 #3501 Heroix: 不过,你的速度很快。删掉了这个帖子,因为我自己发现了它。非常感谢! 很高兴听到你的声音,我以为我在回复一个找不到的旧帖子呢 :) neo333 2013.05.21 06:54 #3502 tara: 而在 "工具-设置 "菜单的 "事件 "选项卡中,情况却相当糟糕。尝试使用它 :( 我同意,这很糟糕......。警报不能通过空格键关闭,只能手动关闭。改变 "服务-设置-事件 "中的警报参数没有任何作用 ... Сергей 2013.05.21 10:20 #3503 伙计们,请给我一个提示。我已经问过这个问题了,但我还没能把代码弄好。我再一次告诉你这个想法的要点。通过Awesom指标,从底部(低于0)到顶部(高于0),计算出波的体积(指标Volumes)。带有波浪量总和的文本标签,应打印在指标图上,并在整个历史上计算。我得到了这个。错误是什么?#property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 SteelBlue #property indicator_width1 2 //---- basic fan indicator parameters extern bool Show_AOLine_2=true; extern int SlowEMA3=34; extern int EMA=3; extern bool Show_Volume=true; extern double coaf=0.5; //---- indicator buffers double AOBuffer3[]; double ExtMapBuffer1[]; double VLUP, AO_up,AO_dn; double prhgh_e=0, prhgh_s, prlw_e=0, prlw_s; datetime tmhgh, tmlw; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- drawing settings string name_ind = "Awesome_super_volumes"; IndicatorShortName("Awesome_super_volumes"); //---- AO_fan line 2 (basic) if(Show_AOLine_2 ==true){Show_AOLine_2=DRAW_LINE; } else {Show_AOLine_2=DRAW_NONE; } SetIndexBuffer(0,AOBuffer3); SetIndexStyle(0,Show_AOLine_2); SetIndexLabel(0,"basic line"); SetIndexBuffer(1,ExtMapBuffer1); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexLabel(1,"Volume"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Awesome Oscillator | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); double prev,current; //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; i<limit; i++) { //---- AO_fan + Volumes AOBuffer3[i]=iMA(NULL,0,EMA,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,SlowEMA3,0,MODE_SMA,PRICE_MEDIAN,i); if (Show_Volume==true) { double nSum = Volume[i]*Point*coaf; if (AOBuffer3[i]<=0)ExtMapBuffer1[i] = nSum; if (AOBuffer3[i]>0)ExtMapBuffer1[i] = -nSum; double Vol_Arr[]; if (AOBuffer3[i]<=0)Vol_Arr[i]=Volume[i]*Point*coaf; if (AOBuffer3[i]>0)Vol_Arr[i] = -Volume[i]*Point*coaf; } } //-- Поиск High & Time & Min_AO if (AOBuffer3[i]>0) { AO_up = AOBuffer3[i]*0.1+AOBuffer3[i]; prhgh_s = High[i]; if (prhgh_s >= prhgh_e) {prhgh_e = prhgh_s; tmhgh = Time[i];} //SetText("Awesome_super_volumes"+Close[i], DoubleToStr(VLUP,0), tmhgh, AO_up, Black); } //-- Поиск Low & Time & Max_AO if (AOBuffer3[i]<0) { AO_dn = AOBuffer3[i]*0.1+AOBuffer3[i]; prlw_s = Low[i]; if (prlw_s > prlw_e) {prlw_e = prlw_s; tmlw = Time[i];} //SetText("Awesome_super_volumes"+Close[i], DoubleToStr(VLUP,0), tmlw, AO_dn, Black); } // -- Пересчет баров от High до Low if(NewBar()) { int colbr = iBarShift(NULL,0,tmhgh)-iBarShift(NULL,0,tmlw); int shift=iBarShift(NULL,0,tmhgh); for (i=0; i<=colbr; i++) {VLUP += MathAbs(iVolume(NULL,0, shift+i));} } Comment("Vol_",VLUP,prlw_e,prhgh_e); for(i=0; i<limit; i++) { SetText("Awesome_super_volumes"+Close[i], DoubleToStr(VLUP,0), tmlw, AO_dn, Black); } //---- done return(0); } //+------------------------------------------------------------------+ void SetText(string name, string Vl, datetime t1, double p1, color c) { // if (ObjectFind(name)!=-1) ObjectDelete(name); ObjectCreate(name,OBJ_TEXT,WindowFind("Awesome_super_volumes"),0,0,0,0); ObjectSetText(name, Vl, 10, "Times New Roman", c); ObjectSet(name, OBJPROP_TIME1 , t1); ObjectSet(name, OBJPROP_PRICE1, p1); ObjectSet(name, OBJPROP_COLOR, c); } bool NewBar() { static datetime lastbar = 0; datetime curbar = Time[0]; if(lastbar!=curbar) { lastbar=curbar; return (true); } else { return(false); }} Viktar Dzemikhau 2013.05.21 12:27 #3504 该EA在图表上抛出了一堆订单。我的函数可以找到公开市场订单、待定出价和结算的数量。我又增加了一个内置函数,可以找到挂单的最大和最小价格的值,以便更快检查出一件事。我可以通过印刷品看到,在某个时刻,它发现的价值不是我想要的。我们的想法是,如果挂单已经关闭,需要跳过它们,但这个函数由于某些原因没有跳过它们。这里有一个函数。//+-------------------------------------------------------------------------------------+ //| Поиск своих ордеров | //+-------------------------------------------------------------------------------------+ void FindOrders() { int total = OrdersTotal() - 1; amountOfCurrPendingBuys = 0; amountOfCurrPendingSells = 0; amountOfCurrMarketOrders = 0; priceMinOfBuy = 0; priceMaxOfSell = 0; for (int i=total; i>=0; i--) { if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if (OrderSymbol() != Symbol()) continue; if (OrderMagicNumber() != i_magic) continue; if (OrderCloseTime() != 0) continue; { if (OrderType() == OP_BUYSTOP) { amountOfCurrPendingBuys++; if (priceMaxOfBuy < OrderOpenPrice() || priceMaxOfBuy == 0) { priceMaxOfBuy = OrderOpenPrice(); } if (priceMinOfBuy > OrderOpenPrice() || priceMinOfBuy == 0) { priceMinOfBuy = OrderOpenPrice(); } } if (OrderType() == OP_SELLSTOP) { amountOfCurrPendingSells++; if (priceMaxOfSell < OrderOpenPrice() || priceMaxOfSell == 0) { priceMaxOfSell = OrderOpenPrice(); } if (priceMinOfSell > OrderOpenPrice() || priceMinOfSell == 0) { priceMinOfSell = OrderOpenPrice(); } } amountOfCurrMarketOrders++; } } Print("FindOrders() : priceMaxOfBuy ", priceMaxOfBuy); Print("FindOrders() : priceMinOfBuy ", priceMinOfBuy); Print("FindOrders() : priceMaxOfSell ", priceMaxOfSell); Print("FindOrders() : priceMinOfSell ", priceMinOfSell); Print("FindOrders() : amountOfCurrPendingBuys ", amountOfCurrPendingBuys); Print("FindOrders() : amountOfCurrPendingSells ", amountOfCurrPendingSells); Print("FindOrders() : amountOfCurrMarketOrders ", amountOfCurrMarketOrders); }我有一个明确的条件。if (OrderCloseTime() != 0) continue;这意味着,如果一个订单的关闭时间不为零,它就是关闭的,我们应该跳过它。在输出上,我看到它没有跳过它们。以下是图表。为什么会得到错误的停顿价格?因为在我看来,这个代码是正确的。 Victor Nikolaev 2013.05.21 13:19 #3505 hoz: 我的条件已经清楚地写出来了。if (OrderCloseTime() != 0) continue; 前进的是什么? Viktar Dzemikhau 2013.05.21 14:40 #3506 Vinin: 什么是待处理订单? 因此,对于活跃的订单,收盘价 在逻辑上是零(因为它没有关闭),但对于已经关闭的订单,收盘价不是零(收盘价将是它被删除时的价格)。从逻辑上讲,这就是关门时间?我明白,挂单不是关闭而是删除,但我们还应该如何实现? Рустам 2013.05.21 15:48 #3507 你能写出你需要的函数吗? - 找到最外层的垂体? Рустам 2013.05.21 15:51 #3508 //+-------------------------------------------------------------------------------------+ //| Поиск своих ордеров | //+-------------------------------------------------------------------------------------+ void FindOrders() { int total = OrdersTotal() - 1; amountOfCurrPendingBuys = 0; amountOfCurrPendingSells = 0; amountOfCurrMarketOrders = 0; priceMinOfBuy = 0; priceMaxOfSell = 0; for (int i=total; i>=0; i--) { if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if (OrderSymbol() != Symbol()) continue; if (OrderMagicNumber() != i_magic) continue; if (OrderCloseTime() != 0) continue; {// к чему относятся эти скобки ??? уберите их и if (OrderCloseTime() != 0) continue; наконец то заработает if (OrderType() == OP_BUYSTOP) { amountOfCurrPendingBuys++; if (priceMaxOfBuy < OrderOpenPrice() || priceMaxOfBuy == 0) { priceMaxOfBuy = OrderOpenPrice(); } if (priceMinOfBuy > OrderOpenPrice() || priceMinOfBuy == 0) { priceMinOfBuy = OrderOpenPrice(); } } if (OrderType() == OP_SELLSTOP) { amountOfCurrPendingSells++; if (priceMaxOfSell < OrderOpenPrice() || priceMaxOfSell == 0) { priceMaxOfSell = OrderOpenPrice(); } if (priceMinOfSell > OrderOpenPrice() || priceMinOfSell == 0) { priceMinOfSell = OrderOpenPrice(); } } amountOfCurrMarketOrders++; } } Print("FindOrders() : priceMaxOfBuy ", priceMaxOfBuy); Print("FindOrders() : priceMinOfBuy ", priceMinOfBuy); Print("FindOrders() : priceMaxOfSell ", priceMaxOfSell); Print("FindOrders() : priceMinOfSell ", priceMinOfSell); Print("FindOrders() : amountOfCurrPendingBuys ", amountOfCurrPendingBuys); Print("FindOrders() : amountOfCurrPendingSells ", amountOfCurrPendingSells); Print("FindOrders() : amountOfCurrMarketOrders ", amountOfCurrMarketOrders); } Рустам 2013.05.21 16:01 #3509 int i, buy_ticket,sell_ticket; double min = Close[0]; double max = Close[0]; for(i = OrdersHistoryTotal()-1;i>=0;i--){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ if(OrderSymbol()!=Symbol()){continue;} if(OrderMagicNumber()!=Magic){continue;} if(OrderType()==OP_BUYSTOP){ if(OrderOpenPrice()>max){ max = OrderOpenPrice(); buy_ticket = OrderTicket(); } } if(OrderType()==OP_SELLSTOP){ if(OrderOpenPrice()<min){ min = OrderOpenPrice(); sell_ticket = OrderTicket(); } } } } if(OrderSelect(buy_ticket,SELECT_BY_TICKET){ if(OrderCloseTime()==0){OrderDelete(OrderTicket());} } if(OrderSelect(sell_ticket,SELECT_BY_TICKET){ if(OrderCloseTime()==0){OrderDelete(OrderTicket());} } Viktar Dzemikhau 2013.05.21 16:06 #3510 FAQ: 你能写出你需要的功能吗--寻找最外层的挂单? 查找最外层挂单的价格。是活动的,不是被删除的。也就是说,我想在我们的搜索中跳过已删除的待处理订单...我希望我已经说得很清楚了? 1...344345346347348349350351352353354355356357358...432 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
不过,你的速度很快。删掉了这个帖子,因为我自己发现了它。非常感谢!
很高兴听到你的声音,我以为我在回复一个找不到的旧帖子呢 :)
而在 "工具-设置 "菜单的 "事件 "选项卡中,情况却相当糟糕。尝试使用它 :(
我同意,这很糟糕......。警报不能通过空格键关闭,只能手动关闭。改变 "服务-设置-事件 "中的警报参数没有任何作用 ...
伙计们,请给我一个提示。我已经问过这个问题了,但我还没能把代码弄好。
我再一次告诉你这个想法的要点。通过Awesom指标,从底部(低于0)到顶部(高于0),计算出波的体积(指标Volumes)。
带有波浪量总和的文本标签,应打印在指标图上,并在整个历史上计算。
我得到了这个。
错误是什么?
该EA在图表上抛出了一堆订单。
我的函数可以找到公开市场订单、待定出价和结算的数量。我又增加了一个内置函数,可以找到挂单的最大和最小价格的值,以便更快检查出一件事。
我可以通过印刷品看到,在某个时刻,它发现的价值不是我想要的。
我们的想法是,如果挂单已经关闭,需要跳过它们,但这个函数由于某些原因没有跳过它们。这里有一个函数。
我有一个明确的条件。
这意味着,如果一个订单的关闭时间不为零,它就是关闭的,我们应该跳过它。
在输出上,我看到它没有跳过它们。以下是图表。
为什么会得到错误的停顿价格?因为在我看来,这个代码是正确的。
我的条件已经清楚地写出来了。
前进的是什么?
什么是待处理订单?
因此,对于活跃的订单,收盘价 在逻辑上是零(因为它没有关闭),但对于已经关闭的订单,收盘价不是零(收盘价将是它被删除时的价格)。从逻辑上讲,这就是关门时间?
我明白,挂单不是关闭而是删除,但我们还应该如何实现?
你能写出你需要的功能吗--寻找最外层的挂单?
查找最外层挂单的价格。是活动的,不是被删除的。也就是说,我想在我们的搜索中跳过已删除的待处理订单...我希望我已经说得很清楚了?