如何编码? - 页 92 1...858687888990919293949596979899...347 新评论 Michel 2008.05.12 14:11 #911 delvinja: 嗨,伙计们,我在过去的三天里一直试图让这个专家顾问在MT4中执行长线交易,但没有成功。 代码见附件。 double ... = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0);[/PHP] I am not sure about the -3 shift parameter : it shift the curve to the left, so the current bar is undefinited. Try to replace all -3 by 0 to see if the buy orders are triggered. I would replace double Var1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0); double Var2 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0); double Var3 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0); double Var4 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_LOWER, Current + 0); double Buy1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0); double Buy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0); double Sell1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0); double Sell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_LOWER, Current + 0); double CloseBuy1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0); double CloseBuy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0); double CloseSell1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0); double CloseSell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0); by [PHP]double Buy1_1 = iMA(NULL, 0, 3, 0, MODE_SMA, PRICE_CLOSE, Current); double Buy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current); double Sell1_1 = Buy1_1; double Sell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_LOWER, Current); double CloseBuy1_1 = Buy1_1; double CloseBuy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current); double CloseSell1_1 = Buy1_1; double CloseSell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current); Rem : - Var1,2,3,4没有被使用。 - CloseBuy1_2和CloseSell1_2都是一样的:其中一个可能是错误的(MODE_LOWER) How to code? Does someone could explain good EA with simple delvinja 2008.05.12 15:40 #912 需要代码方面的帮助 米歇尔,非常感谢你的帮助,这完美地解决了问题!你们是最好的,我终于可以休息一下了。我会让你知道我的测试结果的。 哦,顺便说一下,你是说-3将永远无法在这个专家顾问中工作? 再次感谢。 Michel 2008.05.12 17:34 #913 delvinja:...哦,顺便说一下,你是说-3永远无法在这个专家顾问中工作? 再次感谢。 说实话,我从来没有真正理解过这个移位的用途:如果你想知道当前柱状体前3个柱状体的指标值,只需使用3作为移位,但最后一个;第一个只是移位曲线的画法,如果你使用一个负值,就像过去知道未来一样...... 总之,我很高兴有人能向我解释它的用途! 但是,为了回答你的问题,请尝试了解你想遵循的确切策略,从哪里来的-3? [删除] 2008.05.13 04:07 #914 你好 在这位专家身上,我想把所有的sl修改为与tp相同的最后一个订单sl,但我不能这样做。 请帮助我 附加的文件: javadea.mq4 9 kb benitohau 2008.05.13 08:30 #915 我做了什么? 我需要帮助在MT4中进行编码 我有以下一些代码。 StopLoss=EMAtrend-iClose(NULL,0,1); TakeProfit=StopLoss If(EMAshort>EMAlong && EMAshort_prev<EMAlong_prev) { OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask+StopLoss*Point,Bid+TakeProfit*Point, "Buy atclose price",10000,0,Green); } 如果(EMAshortEMAlong_prev) { OrderSend(Symbol(),OP_SELL,Lots,Bid,0,StopLoss,Bid+TakeProfit*Point, "Sell at close price",11000,0,Red); } 这个想法是。 1.当满足条件时,以收盘价开立订单。 2.我想让EMAtrend成为止损位。 3.EMAtrend与收盘价之间的距离将是开盘价的止盈距离。 我尝试了上面的代码,但什么都没有发生,而且有一个错误130。 请帮助我。 How to code? [警告关闭!]任何新手问题,为了不给论坛添乱。专业人士,不要走过。没有你,哪里都不能去。 [WARNING CLOSED!] Any newbie brumsey 2008.05.13 09:36 #916 需要帮助的代码 大家好 我正试图让一个EA编译,但它出现了以下错误。 'TradeSymbol' - expression on global scope not allowed I:\Program Files\MetaTrader - Alpari\experts\TTL.mq4 (65, 34)[/CODE] Now the part of the ea causing this is right at the start of the code : string TradeSymbol; TradeSymbol=Symbol(); If I block this out it comes up with errors for the following bit of code : [CODE] if(TotalTradesThisSymbol(TradeSymbol)==0) { int BS=0,SS=0,BL=0,SL=0; } if(TotalTradesThisSymbol(TradeSymbol)>0) { for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()== Symbol) { if(OrderMagicNumber()==11) { BS=OrderTicket(); } if(OrderMagicNumber()==22) { SS=OrderTicket(); } if(OrderMagicNumber()==33) { BL=OrderTicket(); } if(OrderMagicNumber()==44) { SL=OrderTicket(); } }//end if(OrderSymbol }//end for }//end if */ 我想知道的是,是否有一个简单的方法来解决这个问题。 我不擅长编码,只会复制和粘贴。 谢谢你 巴沙 How to code? Closing a Pending Order iFractals custom code problem. Michel 2008.05.13 12:56 #917 basza: 大家好我正试图让一个EA进行编译,但它出现了以下错误。 'TradeSymbol' - expression on global scope not allowed I:\Program Files\MetaTrader - Alpari\experts\TTL.mq4 (65, 34)[/CODE] Now the part of the ea causing this is right at the start of the code : string TradeSymbol; TradeSymbol=Symbol(); If I block this out it comes up with errors for the following bit of code : [CODE] if(TotalTradesThisSymbol(TradeSymbol)==0) { int BS=0,SS=0,BL=0,SL=0; } if(TotalTradesThisSymbol(TradeSymbol)>0) { for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()== Symbol) { if(OrderMagicNumber()==11) { BS=OrderTicket(); } if(OrderMagicNumber()==22) { SS=OrderTicket(); } if(OrderMagicNumber()==33) { BL=OrderTicket(); } if(OrderMagicNumber()==44) { SL=OrderTicket(); } }//end if(OrderSymbol }//end for }//end if */ 我想知道的是,是否有一个简单的方法来解决这个问题。 我不擅长编码,只擅长复制和粘贴。 预先感谢 巴沙 你可以将TradeSymbol定义为全局勺子上的字符串,但在那里你不能评估函数 Symbol()。所以用 "Symbol() "替换所有的 "TradeSymbol",或者像这样在init()或start()函数中赋值。 void Init(){TradeSymbol=Symbol();} payback 2008.05.14 10:11 #918 在编程方面的帮助 你好,我正在尝试为一个EA编程,我跟随你的课程(非常有趣!)。 我很清楚如何用java和一些c++编程。 我试图用大脑趋势指标来编程一个EA,背后的想法是 当BrainTrend2stop和BrainTrend1stop的DOT出现时,买入(反之亦然)。 但如果我像这样调用icustom函数 BuyValueCurrent = iCustom(NULL,TimeFrame, IndicatorName1,NumBars,0,1) ; 我只得到指标在当前栏中的值 有什么方法可以让它变成布尔值吗? buy=true BuyCondition = (IndicatorName1=true && IndicatorName2=true)。 谁能帮帮我,请帮帮我? clarc 2008.05.14 13:31 #919 控制一个进场订单是否被执行... 我有一个EA,可以开仓和管理头寸,但有时会给指示器多个相同的信号,EA每次都会在这个信号出现时开一个新的头寸--但我不想要第二个或第三个等等的头寸,我只想要第一个头寸--是否有可能让EA根据神奇的数字和配对来检查 开仓,以避免这种多次进入? Michel 2008.05.14 18:38 #920 payback: 我正在尝试编程一个EA,我跟随你的课程(非常有趣!)。我对java和一些c++的编程很了解。 我试图用大脑趋势指标来编程一个EA,背后的想法是 当BrainTrend2stop和BrainTrend1stop的DOT出现时,买入(反之亦然)。 但如果我像这样调用icustom函数 BuyValueCurrent = iCustom(NULL,TimeFrame, IndicatorName1,NumBars,0,1) ; 我只得到指标在当前条中的值 有什么方法可以让它变成布尔值吗? buy=true BuyCondition = (IndicatorName1=true && IndicatorName2=true); 谁能帮帮我,请帮帮我? BuyCondition = BuyValueCurrent1 != EMPTY_VALUE && BuyValueCurrent2 != EMPTY_VALUE; 1...858687888990919293949596979899...347 新评论 原因: 取消 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
嗨,伙计们,我在过去的三天里一直试图让这个专家顾问在MT4中执行长线交易,但没有成功。 代码见附件。
I am not sure about the -3 shift parameter : it shift the curve to the left, so the current bar is undefinited. Try to replace all -3 by 0 to see if the buy orders are triggered.
I would replace
double Var2 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0);
double Var3 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0);
double Var4 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_LOWER, Current + 0);
double Buy1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0);
double Buy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0);
double Sell1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0);
double Sell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_LOWER, Current + 0);
double CloseBuy1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0);
double CloseSell1_1 = iMA(NULL, 0, 3, -3, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current + 0);by
[PHP]double Buy1_1 = iMA(NULL, 0, 3, 0, MODE_SMA, PRICE_CLOSE, Current);
double Buy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current);
double Sell1_1 = Buy1_1;
double Sell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_LOWER, Current);
double CloseBuy1_1 = Buy1_1;
double CloseBuy1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current);
double CloseSell1_1 = Buy1_1;
double CloseSell1_2 = iBands(NULL, 0, 20, 2, 1, PRICE_CLOSE, MODE_UPPER, Current);Rem :
- Var1,2,3,4没有被使用。
- CloseBuy1_2和CloseSell1_2都是一样的:其中一个可能是错误的(MODE_LOWER)
需要代码方面的帮助
米歇尔,非常感谢你的帮助,这完美地解决了问题!你们是最好的,我终于可以休息一下了。我会让你知道我的测试结果的。
哦,顺便说一下,你是说-3将永远无法在这个专家顾问中工作? 再次感谢。
...哦,顺便说一下,你是说-3永远无法在这个专家顾问中工作? 再次感谢。
说实话,我从来没有真正理解过这个移位的用途:如果你想知道当前柱状体前3个柱状体的指标值,只需使用3作为移位,但最后一个;第一个只是移位曲线的画法,如果你使用一个负值,就像过去知道未来一样......
总之,我很高兴有人能向我解释它的用途!
但是,为了回答你的问题,请尝试了解你想遵循的确切策略,从哪里来的-3?
你好
在这位专家身上,我想把所有的sl修改为与tp相同的最后一个订单sl,但我不能这样做。
请帮助我
我做了什么?
我需要帮助在MT4中进行编码
我有以下一些代码。
StopLoss=EMAtrend-iClose(NULL,0,1);
TakeProfit=StopLoss
If(EMAshort>EMAlong && EMAshort_prev<EMAlong_prev)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask+StopLoss*Point,Bid+TakeProfit*Point, "Buy atclose price",10000,0,Green);
}
如果(EMAshortEMAlong_prev)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,0,StopLoss,Bid+TakeProfit*Point, "Sell at close price",11000,0,Red);
}
这个想法是。
1.当满足条件时,以收盘价开立订单。
2.我想让EMAtrend成为止损位。
3.EMAtrend与收盘价之间的距离将是开盘价的止盈距离。
我尝试了上面的代码,但什么都没有发生,而且有一个错误130。
请帮助我。
需要帮助的代码
大家好
我正试图让一个EA编译,但它出现了以下错误。
Now the part of the ea causing this is right at the start of the code :
If I block this out it comes up with errors for the following bit of code :
[CODE] if(TotalTradesThisSymbol(TradeSymbol)==0) { int BS=0,SS=0,BL=0,SL=0; }
if(TotalTradesThisSymbol(TradeSymbol)>0) {
for(cnt=0;cnt<total;cnt++) {
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()== Symbol) {
if(OrderMagicNumber()==11) { BS=OrderTicket(); }
if(OrderMagicNumber()==22) { SS=OrderTicket(); }
if(OrderMagicNumber()==33) { BL=OrderTicket(); }
if(OrderMagicNumber()==44) { SL=OrderTicket(); }
}//end if(OrderSymbol
}//end for
}//end if */我想知道的是,是否有一个简单的方法来解决这个问题。
我不擅长编码,只会复制和粘贴。
谢谢你
巴沙
大家好
我正试图让一个EA进行编译,但它出现了以下错误。
Now the part of the ea causing this is right at the start of the code :
If I block this out it comes up with errors for the following bit of code :
[CODE] if(TotalTradesThisSymbol(TradeSymbol)==0) { int BS=0,SS=0,BL=0,SL=0; }
if(TotalTradesThisSymbol(TradeSymbol)>0) {
for(cnt=0;cnt<total;cnt++) {
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()== Symbol) {
if(OrderMagicNumber()==11) { BS=OrderTicket(); }
if(OrderMagicNumber()==22) { SS=OrderTicket(); }
if(OrderMagicNumber()==33) { BL=OrderTicket(); }
if(OrderMagicNumber()==44) { SL=OrderTicket(); }
}//end if(OrderSymbol
}//end for
}//end if */我想知道的是,是否有一个简单的方法来解决这个问题。
我不擅长编码,只擅长复制和粘贴。
预先感谢
巴沙你可以将TradeSymbol定义为全局勺子上的字符串,但在那里你不能评估函数 Symbol()。所以用 "Symbol() "替换所有的 "TradeSymbol",或者像这样在init()或start()函数中赋值。
在编程方面的帮助
你好,我正在尝试为一个EA编程,我跟随你的课程(非常有趣!)。
我很清楚如何用java和一些c++编程。
我试图用大脑趋势指标来编程一个EA,背后的想法是
当BrainTrend2stop和BrainTrend1stop的DOT出现时,买入(反之亦然)。
但如果我像这样调用icustom函数
BuyValueCurrent = iCustom(NULL,TimeFrame, IndicatorName1,NumBars,0,1) ;
我只得到指标在当前栏中的值
有什么方法可以让它变成布尔值吗?
buy=true
BuyCondition = (IndicatorName1=true && IndicatorName2=true)。
谁能帮帮我,请帮帮我?
控制一个进场订单是否被执行...
我有一个EA,可以开仓和管理头寸,但有时会给指示器多个相同的信号,EA每次都会在这个信号出现时开一个新的头寸--但我不想要第二个或第三个等等的头寸,我只想要第一个头寸--是否有可能让EA根据神奇的数字和配对来检查 开仓,以避免这种多次进入?
我正在尝试编程一个EA,我跟随你的课程(非常有趣!)。
我对java和一些c++的编程很了解。
我试图用大脑趋势指标来编程一个EA,背后的想法是
当BrainTrend2stop和BrainTrend1stop的DOT出现时,买入(反之亦然)。
但如果我像这样调用icustom函数
BuyValueCurrent = iCustom(NULL,TimeFrame, IndicatorName1,NumBars,0,1) ;
我只得到指标在当前条中的值
有什么方法可以让它变成布尔值吗?
buy=true
BuyCondition = (IndicatorName1=true && IndicatorName2=true);
谁能帮帮我,请帮帮我?