需要一些帮助 - 页 2 12345678 新评论 Qæs 2014.02.15 19:24 #11 WHRoeder: 不要单独使用tickvalue https://www.mql5.com/en/forum/133792/page3#512466 我无法理解你想告诉我的东西。 pipValue = (MarketInfo(Symbol(),MODE_TICKVALUE))*10; 在你分享的链接中,我也没有明白你的意思。在我的代码中。 if (Digits == 5 || Digits == 3) { pips2dbl = Point*10; pips2point = 10; pipValue = (MarketInfo(Symbol(),MODE_TICKVALUE))*10; } else { pips2dbl = Point; pips2point = 1; pipValue = (MarketInfo(Symbol(),MODE_TICKVALUE))*1; } Slippage = pips2dbl*MaxSlippage; TP = pips2dbl*Limit_TP; SL = pips2dbl*Limit_SL; 能否请你修改一下?这样我就能更好地理解它了。 @RaptorUK 这一次... int i,j,k; and int i = 0, j, k; 都成功了,没有错误。很奇怪。但我还是把它改了。 Qæs 2014.02.17 21:12 #12 现在我在哪里可以找到https://docs.mql4.com/indicators/iama?? Simon Gniadkowski 2014.02.17 22:39 #13 qgmql: 我现在在哪里可以找到https://docs.mql4.com/indicators/iama???它坏了,我已经向服务台提交了一张票 ...... 同时 ...... iMA 计算移动平均线指标并返回其值。 double iMA( string symbol, // symbol int timeframe, // timeframe int ma_period, // MA平均周期 int ma_shift, // MA shift int ma_method, // 平均方法。 int applied_price, // 应用价格 int shift // shift ); 参数 符号 [in] 将计算指标的数据的符号名称。NULL 表示当前符号。 时间范围 [in] 时间框架。它可以是ENUM_TIMEFRAMES 的任何一个枚举值。0表示当前图表的时间框架。 平均值(ma_period [in] 用于计算的平均周期。 MA_shift [in] MA移位。指标线的偏移与图表中的时间段有关。 ma_method [in] 移动平均法。它可以是ENUM_MA_METHOD 的任何一个枚举值。 应用价格 [in] 应用价格。它可以是ENUM_APPLIED_PRICE 的任何一个枚举值。 变化 [in] 从指标缓冲器中提取的数值的索引(相对于当前的条形图,在给定的时间段之前移动)。 返回值 移动平均数指标的数值。 例子。 AlligatorJawsBuffer[i]=iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,i) 。 Simon Gniadkowski 2014.02.18 09:25 #14 RaptorUK: 它坏了,我已经向服务台提交了一张票 ......同时 ......。 支持团队 2014.02.18 08:09固定了。谢谢你。 iMA() Qæs 2014.02.19 16:17 #15 我应该用什么来启动专家功能? void ontick() { } return; //OR... int start() { } return(o); 或者我可以在新的元编辑器中同时使用吗? (我想我问的是一个非常基本的问题,但实际上我的知识是零,并且有兴趣学习。) Simon Gniadkowski 2014.02.19 17:20 #16 qgmql: 我应该用什么来启动专家功能? 或者我可以在新的元编辑器中同时使用吗? (我想我问的是一个非常基本的问题,但实际上我的知识是零,并且有兴趣学习。) 你可以使用任何一种......但为了将来的兼容性,请使用OnTick() Qæs 2014.02.24 19:31 #17 我曾多次尝试为我的EA获取 "LotsProgression "功能的代码,但它令人困惑。你们能不能在下面的源代码中突出显示为 "手数进展 "而编写的代码?(也请告诉我如何突出显示源代码的某些部分,比如这里 extern int expertId = 183547; extern int TakeProfit=40; extern int StopLoss=10; extern int BreakevenStop = 30; extern bool TimeEntry=true; extern string StartTime="7:00"; extern string StopTime="17:00"; extern bool PriceEntry=false; extern double Price=1.5500; extern bool FirstLong=false; extern string LotsProgression="0.1;0.1;0.2;0.3;0.4;0.6;0.8;1.1;1.5;2.0;2.7;3.6;4.7;6.2;8.0;10.2;13.0;16.5;20.8;26.3;33.1;41.6;52.2;65.5;82.5;103.9;130.9;165;207.9;262;330.1;416;524.7;661.1"; extern bool RestartNewCycle = true; extern int slippage=3; //slippage for market order processing extern int OrderTriesNumber=10; //to repeat sending orders when you receive an error or requote extern string EAName="PowerSM"; bool buysig,sellsig,cycleended; int tries,long,short,co,plen,lord,mord,lpos; double Lot,lots[],tlot,lop,lcp,lsl,ltp; double lbid = -1; int counter = 0; int init() { int i,j,k; string ls; while (true) { j=StringFind(LotsProgression,";",i); if (j>0) { ls=StringSubstr(LotsProgression,i,j-i); i=j+1; k++; ArrayResize(lots,k); lots[k-1]=StrToDouble(ls); } else { ls=StringSubstr(LotsProgression,i); k++; ArrayResize(lots,k); lots[k-1]=StrToDouble(ls); break; } } plen=ArraySize(lots); } void start() { //---- check for history and trading if(Bars<100 || IsTradeAllowed()==false) return; if (lbid == -1) lbid = Bid; co=CalculateCurrentOrders(); if (co > 0) counter = 1; CheckForSignals(); CheckForOpen(); DoBreakEven(BreakevenStop,0); lbid = Bid; } int CalculateCurrentOrders() { int ord; string c; //---- for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderSymbol()==Symbol() && OrderMagicNumber()==expertId) { ord++; if (OrderType()==OP_BUY) { mord=1; if (OrderClosePrice()-OrderOpenPrice()>BreakevenStop*Point) tlot=MathAbs(tlot); else tlot=-MathAbs(tlot); } if (OrderType()==OP_SELL) { mord=-1; if (-OrderClosePrice()+OrderOpenPrice()>BreakevenStop*Point) tlot=MathAbs(tlot); else tlot=-MathAbs(tlot); } c=StringSubstr(OrderComment(),0,StringFind(OrderComment(),"_",0)); lpos=StrToInteger(c); return(ord); } } //---- return orders volume return(ord); } double GetLastTrade() { int ord; lord=0; string c; //---- for(int i=OrdersHistoryTotal()-1;i>=0;i--) { if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) continue; if(OrderSymbol()==Symbol() && OrderMagicNumber()==expertId) { if (OrderType()==OP_BUY) lord=1; if (OrderType()==OP_SELL) lord=-1; c=StringSubstr(OrderComment(),0,StringFind(OrderComment(),"_",0)); lpos=StrToInteger(c); lop = NormalizeDouble(OrderOpenPrice(), Digits); lcp = NormalizeDouble(OrderClosePrice(), Digits); lsl = NormalizeDouble(OrderStopLoss(), Digits); ltp = NormalizeDouble(OrderTakeProfit(), Digits); if (OrderProfit()>0) return(OrderLots()); else return(-OrderLots()); } } return(0); } bool IsEntryTime() { datetime tm0 = TimeCurrent(); datetime tm1 = StrToTime(TimeToStr(tm0, TIME_DATE) + " " + StartTime); datetime tm2 = StrToTime(TimeToStr(tm0, TIME_DATE) + " " + StopTime); bool isTm = false; if (tm1 <= tm2) isTm = isTm || (tm1 <= tm0 && tm0 < tm2); else isTm = isTm || (tm1 <= tm0 || tm0 < tm2); return (isTm); } void CheckForSignals() { buysig = false; sellsig = false; if (co > 0) return; if (TimeEntry) { bool cond = IsEntryTime(); if (!cond) return; } if (PriceEntry) { cond = ((Bid >= Price && lbid < Price) || (Bid <= Price && lbid > Price)); if (!cond) return; } double lastlot = GetLastTrade(); if (lastlot >= 0) { if (counter > 0) { if (!RestartNewCycle) return; } if (FirstLong) buysig = true; else sellsig = true; lpos = 0; Lot = lots[0]; } else { lpos++; int BE = 0; if (lord > 0 && lcp == lop+BE*Point) lpos--; if (lord < 0 && lcp == lop-BE*Point) lpos--; Lot = lots[lpos]; if (lord > 0) sellsig = true; else if (lord < 0) buysig = true; } } void CheckForOpen() { int res,tr,TP; //---- sell conditions if(sellsig && co==0) { Print("sell open ",Lot," ",lpos); res = OpenAtMarket(OP_SELL,Lot,TakeProfit,lpos); if (res>0) { tlot=Lot; } return; } //---- buy conditions if(buysig && co==0) { Print("buy open ",Lot," ",lpos); res = OpenAtMarket(OP_BUY,Lot,TakeProfit,lpos); if (res>0) { tlot=Lot; } return; } } int OpenAtMarket(int mode,double lot,int TP,int pos) { int res,tr,col; double openprice,sl,tp; tries=0; while (res<=0 && tries<OrderTriesNumber) { tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); } RefreshRates(); if (mode==OP_SELL) { openprice=Bid; if (StopLoss>0) sl=openprice+StopLoss*Point; if (TP>0) tp=openprice-TP*Point; col=Red; } else { openprice=Ask; if (StopLoss>0) sl=openprice-StopLoss*Point; if (TP>0) tp=openprice+TP*Point; col=Blue; } res=OrderSend(Symbol(),mode,lot,openprice,slippage,sl,tp,pos+"_"+EAName+"_"+expertId,expertId,0,col); tries++; } Print("market order:: ",Symbol()," ",mode," ",lot," ",openprice," ",sl," ",tp," ",pos+"_"+EAName+"_"+expertId); if (res<=0) Print("error opening order : ",ErrorDescription(GetLastError())); return(res); } void DoBreakEven(int BP, int BE) { bool bres; for (int i = 0; i < OrdersTotal(); i++) { if ( !OrderSelect (i, SELECT_BY_POS) ) continue; if ( OrderSymbol() != Symbol() || OrderMagicNumber() != expertId ) continue; if ( OrderType() == OP_BUY ) { if (Bid<OrderOpenPrice()+BP*Point) continue; if ( OrderOpenPrice()+BE*Point-OrderStopLoss()>Point/10) { //Print(BP," ",BE," bestop"); bres=OrderModify (OrderTicket(), OrderOpenPrice(), OrderOpenPrice()+BE*Point, OrderTakeProfit(), 0, Black); if (!bres) Print("Error Modifying BE BUY order : ",ErrorDescription(GetLastError())); } } if ( OrderType() == OP_SELL ) { if (Ask>OrderOpenPrice()-BP*Point) continue; if ( OrderStopLoss()-(OrderOpenPrice()-BE*Point)>Point/10) { //Print(BP," ",BE," bestop"); bres=OrderModify (OrderTicket(), OrderOpenPrice(), OrderOpenPrice()-BE*Point, OrderTakeProfit(), 0, Gold); if (!bres) Print("Error Modifying BE SELL order : ",ErrorDescription(GetLastError())); } } } return; } /* int FindPos(double ls) { for (int i=0; i<plen; i++) { if (NormalizeDouble(MathAbs(lots[i]-ls),3)<0.001) return(i); } return(-1); } */ William Roeder 2014.02.24 20:03 #18 qgmql: 突出下面源码中的代码,这是为lot递增写的?(也请告诉我如何突出显示 源代码的某些部分。 在initextern string LotsProgression="0.1;0.1;0.2;0.3;0.4;0.6;0.8;1.1;1.5;2.0;2.7;3.6;4.7;6.2;8.0;10.2;13.0;16.5;20.8;26.3;33.1;41.6;52.2;65.5;82.5;103.9;130.9;165;207.9;262;330.1;416;524.7;661.1"; 成为 double lots[] 修复你的缩进,你就会看到lot[] 被用在哪里了double lastlot = GetLastTrade(); if (lastlot >= 0){ if (counter > 0){ if (!RestartNewCycle) return; } if (FirstLong) buysig = true; else sellsig = true; lpos = 0; Lot = lots[0]; } else{ lpos++; int BE = 0; if (lord > 0 && lcp == lop+BE*Point) lpos--; if (lord < 0 && lcp == lop-BE*Point) lpos--; Lot = lots[lpos]; if (lord > 0) sellsig = true; else if (lord < 0) buysig = true; } if (lord > 0 && lcp == lop+BE*Point) ==操作数。- MQL4论坛 qjol 2014.02.24 20:10 #19 qgmql: 我曾多次尝试为我的EA获取 "LotsProgression "功能的代码,但它令人困惑。 什么是混乱的,你能解释一下你的问题吗? James Hodges 2014.02.24 20:45 #20 我想,有了这个# 属性严格,你将不得不把i,j,k初始化为一个值。 int i=0,j=0,k=0。 PipPip...Jimdandy 12345678 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
不要单独使用tickvalue https://www.mql5.com/en/forum/133792/page3#512466
我无法理解你想告诉我的东西。
在你分享的链接中,我也没有明白你的意思。在我的代码中。
能否请你修改一下?这样我就能更好地理解它了。
@RaptorUK 这一次...
都成功了,没有错误。很奇怪。但我还是把它改了。
我现在在哪里可以找到https://docs.mql4.com/indicators/iama???
它坏了,我已经向服务台提交了一张票 ...... 同时 ......
iMA
计算移动平均线指标并返回其值。
double iMA(
string symbol, // symbol
int timeframe, // timeframe
int ma_period, // MA平均周期
int ma_shift, // MA shift
int ma_method, // 平均方法。
int applied_price, // 应用价格
int shift // shift
);
参数
符号
[in] 将计算指标的数据的符号名称。NULL 表示当前符号。
时间范围
[in] 时间框架。它可以是ENUM_TIMEFRAMES 的任何一个枚举值。0表示当前图表的时间框架。
平均值(ma_period
[in] 用于计算的平均周期。
MA_shift
[in] MA移位。指标线的偏移与图表中的时间段有关。
ma_method
[in] 移动平均法。它可以是ENUM_MA_METHOD 的任何一个枚举值。
应用价格
[in] 应用价格。它可以是ENUM_APPLIED_PRICE 的任何一个枚举值。
变化
[in] 从指标缓冲器中提取的数值的索引(相对于当前的条形图,在给定的时间段之前移动)。
返回值
移动平均数指标的数值。
例子。
AlligatorJawsBuffer[i]=iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,i) 。
它坏了,我已经向服务台提交了一张票 ......同时 ......。
我应该用什么来启动专家功能?
或者我可以在新的元编辑器中同时使用吗?
(我想我问的是一个非常基本的问题,但实际上我的知识是零,并且有兴趣学习。)
我应该用什么来启动专家功能?
或者我可以在新的元编辑器中同时使用吗?
(我想我问的是一个非常基本的问题,但实际上我的知识是零,并且有兴趣学习。)
我曾多次尝试为我的EA获取 "LotsProgression "功能的代码,但它令人困惑。你们能不能在下面的源代码中突出显示为 "手数进展 "而编写的代码?(也请告诉我如何突出显示源代码的某些部分,比如这里
double lots[]我曾多次尝试为我的EA获取 "LotsProgression "功能的代码,但它令人困惑。
什么是混乱的,你能解释一下你的问题吗?
我想,有了这个# 属性严格,你将不得不把i,j,k初始化为一个值。
int i=0,j=0,k=0。
PipPip...Jimdandy