初学者的问题 MQL5 MT5 MetaTrader 5 - 页 1023 1...101610171018101910201021102210231024102510261027102810291030...1503 新评论 Yury Smagin 2019.04.04 08:35 #10221 如何获得iMA指标在 "零条 "上的数据,即获得当前条上的指标值? 如果我这样做 int OnInit() {handle.MA_CHART=iMA(_Symbol,_Period,period_MA_CHART,0,Signal_MA_Method,Signal_MA_Applied);} void OnTick() {CopyBuffer(handle.MA_CHART, 0, 0, 3, ind_date.MA_CHART);} 呼叫时 ind_date.MA_CHART[0] 我得到的是前一栏的数据,而不是当前的数据。 Vladimir Karputov 2019.04.04 08:43 #10222 Yury Smagin:如何获得iMA指标在 "零条 "上的数据,即获得当前条上的指标值? 如果我这样做 呼叫时 我得到的是前一栏的数据,而不是当前的数据。该阵列需要 ArraySetAsSeries(ind_date.MA_CHART,true); 然后数组中索引为 "0 "的元素将对应于图表中的右栏。 Yury Smagin 2019.04.04 09:03 #10223 Vladimir Karputov:该阵列必须是 然后数组中索引为 "0 "的元素将对应于图表中最右边的柱子。 谢谢你! Alexey Viktorov 2019.04.04 11:05 #10224 Yury Smagin:如何获得iMA指标在 "零条 "上的数据,即获得当前条上的指标值? 如果我这样做 呼叫时 我得到的是前一栏的数据,而不是当前的数据。就像那部电影中的 "我有一些疑虑......"。你不是用我的专家顾问来学习吗? 你不需要翻转阵列。取数组中第二个索引的值就足够了。 ind_date.MA_CHART[2] User_mt5 2019.04.04 13:08 #10225 OBJPROP_BACK 两种方式都试过了。它不起作用。我完全不明白它是如何运作的。 不管价值如何,这些对象只是按照它们形成的顺序显示--最后一个更高。 还有,如果有两个以上的对象,我如何调整它们的水平(层)?也许有一些其他的设置?如果你知道的话,请告诉我。 Yury Smagin 2019.04.05 08:53 #10226 Alexey Viktorov:就像那部电影中的 "我有疑虑......"。你用的不是我的顾问吗,你在研究。 你不需要翻转阵列。只要取数组的第二个索引的值就可以了。 谢谢你! kopeyka2 2019.04.05 12:43 #10227 祝大家一天好心情)) 能否请您告诉我为什么会有不同的结果? //+------------------------------------------------------------------+ //| exponential moving average multytimeframes ДЛЯ БУФЕРА | //+------------------------------------------------------------------+ void CalculateExponentialMA(int rates_total,int prev_calculated,int begin,const double &price[]) { int i,limit; double SmoothFactor=2.0/(1.0+period_ma); //--- first calculation or number of bars was changed if(prev_calculated==0) { limit=period_ma+begin; ExtLineBuffer[begin]=price[begin]; for(i=begin+1;i<limit;i++) ExtLineBuffer[i]=price[i]*SmoothFactor+ExtLineBuffer[i-1]*(1.0-SmoothFactor); } else limit=prev_calculated-1; //--- main loop for(i=limit;i<rates_total && !IsStopped();i++) ExtLineBuffer[i]=price[i]*SmoothFactor+ExtLineBuffer[i-1]*(1.0-SmoothFactor); //--- } //+------------------------------------------------------------------+ //| exponential moving average ДЛЯ ТОЧКИ | //+------------------------------------------------------------------+ void CalculateEMA(int periodMA,int bgn) { int i,lmt=periodMA+bgn+1; double SmoothFactor=2.0/(1.0+periodMA); for(i=0;i<lmt;i++) BufferPrice[i]=0.0; switch(AppliedPrice) { case 1: BufferPrice[lmt]=iClose(NULL,Timeframes,lmt); break; case 2: BufferPrice[lmt]=iOpen(NULL,Timeframes,lmt); break; case 3: BufferPrice[lmt]=iHigh(NULL,Timeframes,lmt); break; case 4: BufferPrice[lmt]=iLow(NULL,Timeframes,lmt); break; default : BufferPrice[lmt]=iClose(NULL,Timeframes,lmt); break; } for(i=lmt-1;i>=0;i--) switch(AppliedPrice) { case 1: BufferPrice[i]=iClose(NULL,Timeframes,i)*SmoothFactor+BufferPrice[i+1]*(1.0-SmoothFactor); break; case 2: BufferPrice[i]=iOpen(NULL,Timeframes,i)*SmoothFactor+BufferPrice[i+1]*(1.0-SmoothFactor); break; case 3: BufferPrice[i]=iHigh(NULL,Timeframes,i)*SmoothFactor+BufferPrice[i+1]*(1.0-SmoothFactor); break; case 4: BufferPrice[i]=iLow(NULL,Timeframes,i)*SmoothFactor+BufferPrice[i+1]*(1.0-SmoothFactor); break; default : BufferPrice[i]=iClose(NULL,Timeframes,i)*SmoothFactor+BufferPrice[i+1]*(1.0-SmoothFactor); break; } MA=NormalizeDouble(BufferPrice[bgn],_Digits); } //+------------------------------------------------------------------+ 问题:我在第二个版本的MA计算中写错了什么? 谢谢你))))。 Aleksey Vyazmikin 2019.04.06 15:39 #10228 在优化时,图形对象的构造是否可以从图形中读取? Artyom Trishkin 2019.04.06 15:53 #10229 Aleksey Vyazmikin:在优化时,图形对象的构造是否可以从图形中读取?没有 Aleksey Vyazmikin 2019.04.06 15:54 #10230 Artyom Trishkin:没有糟糕的是... 1...101610171018101910201021102210231024102510261027102810291030...1503 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
如何获得iMA指标在 "零条 "上的数据,即获得当前条上的指标值?
如果我这样做
呼叫时
ind_date.MA_CHART[0]
我得到的是前一栏的数据,而不是当前的数据。
如何获得iMA指标在 "零条 "上的数据,即获得当前条上的指标值?
如果我这样做
呼叫时
我得到的是前一栏的数据,而不是当前的数据。
该阵列需要
然后数组中索引为 "0 "的元素将对应于图表中的右栏。
该阵列必须是
然后数组中索引为 "0 "的元素将对应于图表中最右边的柱子。
如何获得iMA指标在 "零条 "上的数据,即获得当前条上的指标值?
如果我这样做
呼叫时
我得到的是前一栏的数据,而不是当前的数据。
就像那部电影中的 "我有一些疑虑......"。你不是用我的专家顾问来学习吗?
你不需要翻转阵列。取数组中第二个索引的值就足够了。
ind_date.MA_CHART[2]
OBJPROP_BACK
两种方式都试过了。它不起作用。我完全不明白它是如何运作的。
不管价值如何,这些对象只是按照它们形成的顺序显示--最后一个更高。
还有,如果有两个以上的对象,我如何调整它们的水平(层)?也许有一些其他的设置?如果你知道的话,请告诉我。
就像那部电影中的 "我有疑虑......"。你用的不是我的顾问吗,你在研究。
你不需要翻转阵列。只要取数组的第二个索引的值就可以了。
谢谢你!
祝大家一天好心情))
能否请您告诉我为什么会有不同的结果?
问题:我在第二个版本的MA计算中写错了什么?
谢谢你))))。
在优化时,图形对象的构造是否可以从图形中读取?
没有
没有
糟糕的是...