初学者的问题 MQL5 MT5 MetaTrader 5 - 页 266 1...259260261262263264265266267268269270271272273...1503 新评论 Anatoli Kazharski 2014.06.29 13:01 #2651 jommerbot:好吧,即使在最简单的情况下也是不行的。我不明白我的错误在哪里。在EA和脚本中复制同一指标的缓冲区可以工作,但在指标中不能。指示器手柄被初始化,没有错误。找到差异。)#property copyright "Copyright 2010, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_separate_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed //--- double ExtLineBuffer[]; int iRocHandleEURUSD =INVALID_HANDLE; int iPlotShift =0; int iPeriod =6; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { IndicatorSetInteger(INDICATOR_DIGITS,2); SetIndexBuffer(0,ExtLineBuffer,INDICATOR_DATA); PlotIndexSetInteger(0,PLOT_SHIFT,iPlotShift); PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,iPeriod-1); //--- iRocHandleEURUSD=iCustom("EURUSD",0,"Examples\\ROC"); if(iRocHandleEURUSD==INVALID_HANDLE) Print("Не удалось получить хендл индикатора ROC EURUSD"); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- if(rates_total<iPeriod) return(0); //--- int first=0; double aRocRatesEURUSD[]; ArraySetAsSeries(ExtLineBuffer,true); //--- if(prev_calculated==0) first=0; else first=prev_calculated-1; //--- for(int bar=first; bar<rates_total; bar++) { CopyBuffer(iRocHandleEURUSD,0,bar,1,aRocRatesEURUSD); Print("bar: ",bar,"; value: ",DoubleToString((aRocRatesEURUSD[0]!=EMPTY_VALUE)?aRocRatesEURUSD[0]:0,2)); ExtLineBuffer[bar]=aRocRatesEURUSD[0]; } //--- return(rates_total); } //+------------------------------------------------------------------+ jommerbot 2014.06.30 01:51 #2652 是的,明白了,在我上一版本的代码中,指标处理程序进入了变量的错误范围。我错过了,谢谢你。但有一个问题--在测试器中,在测试期 开始前的历史条上,指标 正常工作,但从测试期开始,新到的点位不被考虑。即一个子指标的缓冲区不被更新。 неAni 2014.06.30 05:11 #2653 好心人,请帮助纠正代码,以便从工作行中 "输入参数 "的顾问 extern string Lot = "0.2 0.2 0.3 0.4 0.5"; //(通过空格),最后一个值(在这种情况下是0.5)会无限地重复,即不输入"0.2 0.2 0.2 0.3 0.4 0.5 0.5 0.5 0.5 0.5"。//----------------------------StringToArrayLot(Lot,xiLot)。//---------------------------------------------------int StringToArrayLot(string st,double &ad[]){ int i=0,np; string stp;ArrayResize(ad,0); while(StringLen(st)>0){ np=StringFind(st," "); if(np<0){ stp=st; st="";}else{ stp=StringSubstr(st,0,np); st=StringSubstr(st,np+1);} i++; ArrayResize(ad,i); ad[i-1]=StrToDouble(stp);} return(ArraySize(ad));} 样板 - 开发程序 Krasev157 Красёв 2014.07.01 14:22 #2654 为什么我不能在网站上或终端上看到我的EA? Vasiliy Smirnov 2014.07.01 14:26 #2655 Krasev157: 为什么我不能在网站上或终端上看到我的EA? 要在网站上看到它,你必须上传它。要在终端编译它。 Krasev157 Красёв 2014.07.01 14:28 #2656 zfs: 要在网站上看到它,你必须上传它。要在终端编译它。我的资料上看不到,但我的资料上看不到。 Vladimir Karputov 2014.07.01 14:44 #2657 Krasev157:将在网站上发布,我在我的个人资料上看不到它。 请给我一个阿尔巴尼亚语词典的链接。 Krasev157 Красёв 2014.07.02 05:12 #2658 barabashkakvn: 请给我一个阿尔巴尼亚语词典的链接。http://www.txtblog.ru/blog/1165306807 给你 Vasiliy Smirnov 2014.07.02 06:37 #2659 Krasev157:http://www.txtblog.ru/blog/1165306807 给你哈塔尔先生着火 了。来吧!巴辛格! gordon 2014.07.02 07:15 #2660 你好,如果不是太麻烦的话,请你告诉我好吗?如何将最后5个点的价格放入一个数组? 1...259260261262263264265266267268269270271272273...1503 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
好吧,即使在最简单的情况下也是不行的。
我不明白我的错误在哪里。在EA和脚本中复制同一指标的缓冲区可以工作,但在指标中不能。指示器手柄被初始化,没有错误。
找到差异。)
是的,明白了,在我上一版本的代码中,指标处理程序进入了变量的错误范围。我错过了,谢谢你。但有一个问题--在测试器中,在测试期 开始前的历史条上,指标 正常工作,但从测试期开始,新到的点位不被考虑。即一个子指标的缓冲区不被更新。
好心人,请帮助纠正代码,以便从工作行中 "输入参数 "的顾问
extern string Lot = "0.2 0.2 0.3 0.4 0.5"; //(通过空格)
,最后一个值(在这种情况下是0.5)会无限地重复,即不输入
"0.2 0.2 0.2 0.3 0.4 0.5 0.5 0.5 0.5 0.5"。
//----------------------------
StringToArrayLot(Lot,xiLot)。
//---------------------------------------------------
int StringToArrayLot(string st,double &ad[])
{
int i=0,np; string stp;ArrayResize(ad,0);
while(StringLen(st)>0)
{
np=StringFind(st," ");
if(np<0)
{
stp=st;
st="";
}else{
stp=StringSubstr(st,0,np);
st=StringSubstr(st,np+1);
}
i++;
ArrayResize(ad,i);
ad[i-1]=StrToDouble(stp);
}
return(ArraySize(ad));
}
为什么我不能在网站上或终端上看到我的EA?
要在网站上看到它,你必须上传它。要在终端编译它。
我的资料上看不到,但我的资料上看不到。
将在网站上发布,我在我的个人资料上看不到它。
请给我一个阿尔巴尼亚语词典的链接。
http://www.txtblog.ru/blog/1165306807 给你
http://www.txtblog.ru/blog/1165306807 给你
哈塔尔先生着火 了。
来吧!
巴辛格!