新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 817 1...810811812813814815816817818819820821822823824...1953 新评论 Maxim Kuznetsov 2019.04.22 22:21 #8161 Seric29:唯一要做的是增加许多小函数,这些函数将检查一个表达式的相等、减法、加法、不等式、乘法等等。 对于比较,你应该有一个类似CompareDoublesWithEpsilon(double d1,d2,epsilon)的函数 - 使用它。 PS/ 什么是 "检查减法、加法、乘法",我不明白:-( yiduwi 2019.04.22 22:55 #8162 我怎样才能从更高的时间框架上看到M1的开盘时间? 如果你想从低处看到高处的酒吧,那么 int limit=rates_total-prev_calculated; if(limit>1) { limit=rates_total-2; ArrayInitialize(BufferUP,EMPTY_VALUE); ArrayInitialize(BufferDN,EMPTY_VALUE); } for(int i=limit; i>=0; i--) { int yy= iBarShift(Symbol(),PERIOD_H1,time[i]); Print("iTime: ", iTime(Symbol(),PERIOD_H1,yy)); } Maxim Kuznetsov 2019.04.22 23:06 #8163 yiduwi:我怎样才能从更高的时间框架上看到M1的开盘时间? 如果你想从低处看到高处的酒吧,那么 如果我没记错的话。 datetime time_h1=iTime(_Symbol,PERIOD_H1,1); // время открытия прошлого бара H1 int bar_m1=iBarShift(_Symbol,PERIOD_M1,time_h1); // соотв. ему бар периода M1 datetime time_m1=iTime(_Symbol,PERIOD_M1,bar_m1); // время его открытия yiduwi 2019.04.22 23:51 #8164 Maxim Kuznetsov:如果我理解正确,那么。 datetime time_h1=iTime(_Symbol,PERIOD_H1,1); // время открытия прошлого бара H1 int bar_m1=iBarShift(_Symbol,PERIOD_M1,time_h1); // соотв. ему бар периода M1 datetime time_m1=iTime(_Symbol,PERIOD_M1,bar_m1); // время его открытия 假设最后一根柱子H1的开盘时间 是01:00:00,我们如何从01:01: 00开盘的柱子M1中获取时间到time_m1变量? Maxim Kuznetsov 2019.04.23 00:16 #8165 yiduwi:假设最后一个H1条 在01:00:00开盘,我如何从01:01:00开盘的M1条中获得时间,进入time_m1变量?time_m1_plus_1=time_h1 + 1 * PeriodSeconds(PERIOD_M1); //突然间 :-) 就在时间上增加1分钟=60秒。 但如果你冒着改变日/会/周或异国货币/指数/基金的风险,为了确定,使用iBarShift,iTime - 因为在体面的地方,酒吧是随着第一笔交易形成的(没有交易量就没有酒吧),但如果没有交易,"快速 "将是 yiduwi 2019.04.23 01:59 #8166 Maxim Kuznetsov:time_m1_plus_1=time_h1 + 1 * PeriodSeconds(PERIOD_M1); //突然间 :-) 就在时间上增加1分钟=60秒。现在,这很有价值--要知道指定的时间是在任何时间框架的一个条形内,你需要做以下工作 for(int i=limit; i>=0; i--) { if(time[i]<=StringToTime("2019.04.23 01:01:00") && time[i]+Period()*PeriodSeconds(PERIOD_M1)>=StringToTime("2019.04.23 01:01:00") { BufferUP[i]=low[i]-10*Point;// } } 但如果时间是偶数,没有分钟"2019.04.23 01:00:00" ,那么箭头就在两个柱子上,在01:00:00的柱子上,在前一个00:00:00的柱子上,如何不多放一个? kopeyka2 2019.04.23 06:23 #8167 一天中的所有部分和季节都很好))火鸡写的。它可以工作,但会在专家部分持续写入错误。尝试解决问题......到目前为止“哪一个到顶部”..)))告诉我,pliz,我因缺乏经验而搞砸的地方......我用红色突出显示代码中有问题的地方......或者绿色会更好!?))) PS我原则上拒绝手柄选项,因为MT5上手柄的工作条件如果代码有严重的错误,愿意支付一些工资。但我想了解问题的本质!!!! //+------------------------------------------------------------------+ //| Ind Sliding Line Level MT5.mq5 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 //+----------------------------------------------+ //| Параметры отрисовки индикатора 1 | //+----------------------------------------------+ #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_width1 1 //---- enum method { Simple= MODE_SMA , Exponential= MODE_EMA , }; //---- enum applied { CLOSE= PRICE_CLOSE , OPEN= PRICE_OPEN , HIGH= PRICE_HIGH , LOW= PRICE_LOW }; //--- входные параметры input int InpMAPeriod = 10 ; // Период мультитаймфреймовой линии input int InpBars = 50 ; // Расчитать баров (Период линии х 5) input int InpMAShift = 0 ; // Сдвиг линии //--- параметры для выбранного таймфрема input string TimeBar = "2019.04.19 00:00" ; //Дата начала отсчета input bool DataBars = false ; //Считать по дате (true) input int MAShift = 2 ; //Сдвиг бара таймфрема input ENUM_TIMEFRAMES Timeframes = PERIOD_D1 ; //Таймфрейм скользящей input method MethodLine = Simple; //Метод расчета скользящей input applied AppliedPrice = CLOSE; //Расчет цены скользящей input ENUM_LINE_STYLE MAStyle = STYLE_DASH ; //Стиль всех скользящих линий input color ColorLine = clrRed ; //Цвет скользящей и таймфрейма input int maWidthAll = 0 ; //Толщина всех скользящих линий input bool Ray = true ; //Сдвиг тренда вправо до шкалы input bool LineTrend = true ; //Выбор Линия(true) Отрезок(false) input bool HLines = false ; //Выключатель горизонтального уровня //---- int i,period_ma,beginbar,nn,BigPeriod; double ExtLineBuffer[],ArrayPrice[]; double SMA= 0.0 ,EMA= 0.0 ; double bp,bp1,bp2,bp3; datetime time_1,time_2; string smaname= "" ,emaname= "" ; string tooltipsma= "" ,tooltipema= "" ; string type_ma= "" ,pr= "" ; bool sma= false ,ema= false ,ok; //+------------------------------------------------------------------+ //| simple moving average multytimeframes | //+------------------------------------------------------------------+ void CalculateSimpleMA( int rates_total, int prev_calculated, int begin, const double &price[]) { int j,limit; //--- first calculation or number of bars was changed if (prev_calculated== 0 ) // first calculation { limit=period_ma+begin; //--- set empty value for first limit bars for (j= 0 ;j<limit- 1 ;j++) ExtLineBuffer[j]= 0.0 ; //--- calculate first visible value double fvalue= 0 ; for (j=begin;j<limit;j++) fvalue+=price[j]; fvalue/=period_ma; ExtLineBuffer[limit- 1 ]=fvalue; } else limit=prev_calculated- 1 ; //--- main loop for (j=limit;j<rates_total && ! IsStopped ();j++) ExtLineBuffer[j]=ExtLineBuffer[j- 1 ]+(price[j]-price[j-period_ma])/period_ma; //--- } //+------------------------------------------------------------------+ //| exponential moving average multytimeframes | //+------------------------------------------------------------------+ void CalculateExponentialMA( int rates_total, int prev_calculated, int begin, const double &price[]) { int q,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 (q=begin+ 1 ;q<limit;q++) ExtLineBuffer[q]=price[q]*SmoothFactor+ExtLineBuffer[q- 1 ]*( 1.0 -SmoothFactor); } else limit=prev_calculated- 1 ; //--- main loop for (q=limit;q<rates_total && ! IsStopped ();q++) ExtLineBuffer[q]=price[q]*SmoothFactor+ExtLineBuffer[q- 1 ]*( 1.0 -SmoothFactor); } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit () { period_ma= int (InpMAPeriod< 1 ? 1 : InpMAPeriod); smaname= "Ind SMA " + string (InpMAPeriod); emaname= "Ind EMA " + string (InpMAPeriod); //--- SetIndexBuffer ( 0 ,ExtLineBuffer, INDICATOR_DATA ); switch (Timeframes) { case PERIOD_MN1 : BigPeriod= PERIOD_MN1 ; ok= true ; pr= "MN1" ; break ; case PERIOD_W1 : BigPeriod= PERIOD_MN1 ; ok= true ; pr= "W1" ; break ; case PERIOD_D1 : BigPeriod= PERIOD_W1 ; ok= true ; pr= "D1" ; break ; case PERIOD_H12 : BigPeriod= PERIOD_D1 ; ok= true ; pr= "H12" ; break ; case PERIOD_H8 : BigPeriod= PERIOD_D1 ; ok= true ; pr= "H8" ; break ; case PERIOD_H4 : BigPeriod= PERIOD_D1 ; ok= true ; pr= "H4" ; break ; case PERIOD_H3 : BigPeriod= PERIOD_H4 ; ok= true ; pr= "H3" ; break ; case PERIOD_H2 : BigPeriod= PERIOD_H4 ; ok= true ; pr= "H2" ; break ; case PERIOD_H1 : BigPeriod= PERIOD_H4 ; ok= true ; pr= "H1" ; break ; case PERIOD_M30 : BigPeriod= PERIOD_H1 ; ok= true ; pr= "M30" ; break ; case PERIOD_M20 : BigPeriod= PERIOD_H1 ; ok= true ; pr= "M20" ; break ; case PERIOD_M15 : BigPeriod= PERIOD_M30 ; ok= true ; pr= "M15" ; break ; case PERIOD_M12 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M12" ; break ; case PERIOD_M10 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M10" ; break ; case PERIOD_M6 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M6" ; break ; case PERIOD_M5 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M5" ; break ; case PERIOD_M4 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M4" ; break ; case PERIOD_M3 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M3" ; break ; case PERIOD_M2 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M2" ; break ; case PERIOD_M1 : BigPeriod= PERIOD_M15 ; ok= true ; pr= "M1" ; break ; } switch (MethodLine) { case Simple: sma= true ; type_ma= "SMA " ; break ; case Exponential: ema= true ; type_ma= "EMA " ; break ; } //--- set accuracy IndicatorSetInteger ( INDICATOR_DIGITS , _Digits ); //--- sets first bar from what index will be drawn PlotIndexSetInteger ( 0 , PLOT_DRAW_BEGIN ,period_ma); //---- line shifts when drawing PlotIndexSetInteger ( 0 , PLOT_SHIFT ,InpMAShift); //--- PlotIndexSetInteger ( 0 , PLOT_LINE_COLOR ,ColorLine); //--- IndicatorSetString ( INDICATOR_SHORTNAME ,type_ma+ " " + string (period_ma)); //---- sets drawing line empty value-- PlotIndexSetDouble ( 0 , PLOT_EMPTY_VALUE , 0.0 ); //---- ChartRedraw ( 0 ); //---- initialization done return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { ObjectsDeleteAll ( 0 ,smaname); ObjectsDeleteAll ( 0 ,emaname); ObjectsDeleteAll ( 0 , "No Period " ); Comment ( "" ); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate ( const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- минимальное количество баров if (rates_total<period_ma- 1 +begin) return ( 0 ); //--- Количество начальных баров без отрисовки и значений PlotIndexSetInteger ( 0 , PLOT_DRAW_BEGIN ,period_ma- 1 +begin); if (prev_calculated== 0 ) { ArrayInitialize (ExtLineBuffer, 0 ); ArrayInitialize (ArrayPrice, 0 ); } //--- calculation switch (MethodLine) { case Simple: CalculateSimpleMA(rates_total,prev_calculated,begin,price); break ; case Exponential: CalculateExponentialMA(rates_total,prev_calculated,begin,price); break ; } //считаем количество элементов буфера int size= ArraySize (ExtLineBuffer); ArrayResize (ArrayPrice,size, 100000 ); //---- Расчет и построение горизонтального уровня выбранного таймфрейма if (DataBars== false ) beginbar=MAShift; if (DataBars== true ) beginbar= iBarShift ( _Symbol ,Timeframes, StringToTime (TimeBar)); time_1= iTime ( _Symbol ,Timeframes,beginbar); time_2= iTime ( _Symbol ,Timeframes, 0 ); if (HLines== true ) { //+------------------------------------------------------------------+ //| Simple Moving Average | //+------------------------------------------------------------------+ if (sma== true && ok== true && Period ()<=BigPeriod) //SMA { int lim=period_ma+beginbar; double firstValue= 0.0 ; for (i=beginbar;i<lim;i++) switch (AppliedPrice) { case 1 : firstValue+= iClose ( _Symbol ,Timeframes,i); break ; case 2 : firstValue+= iOpen ( _Symbol ,Timeframes,i); break ; case 3 : firstValue+= iHigh ( _Symbol ,Timeframes,i); break ; case 4 : firstValue+= iLow ( _Symbol ,Timeframes,i); break ; default : firstValue+= iClose ( _Symbol ,Timeframes,i); break ; } firstValue/=period_ma; //----- SMA= NormalizeDouble (firstValue, _Digits ); if (LineTrend== true ) tooltipsma= "Line " +type_ma+ string (InpMAPeriod)+ " " +pr+ "\n" + TimeToString ( iTime ( _Symbol ,Timeframes,beginbar), TIME_DATE | TIME_MINUTES )+ "\n" + DoubleToString (SMA, _Digits ); else tooltipsma= "Trend " +type_ma+ string (InpMAPeriod)+ " " +pr+ "\n" + TimeToString ( iTime ( _Symbol ,Timeframes,beginbar), TIME_DATE | TIME_MINUTES )+ "\n" + "Original Price: " + DoubleToString (SMA, _Digits ); if (LineTrend== true ) HLine( 0 ,smaname,tooltipsma,time_1,SMA,MAStyle,maWidthAll,ColorLine); else PlotTrend( 0 ,smaname,tooltipsma, 0 ,time_1,SMA,time_2,SMA,ColorLine,MAStyle,maWidthAll, true , false , false , true ); //---- } //sma==true //---------------------------------------------------------------------------------------------------------------- //+------------------------------------------------------------------+ //| Exponential Moving Average | //+------------------------------------------------------------------+ if (ema== true && ok== true && Period ()<=BigPeriod) //EMA { int p,lmt; double SmoothFactor= 2.0 /( 1.0 +period_ma); if (prev_calculated== 0 ) lmt= 0 ; else lmt=InpBars; for (p=lmt;p>=beginbar;p--) { switch (AppliedPrice) { case 1 : ArrayPrice[lmt]= iClose ( _Symbol ,Timeframes,lmt); break ; case 2 : ArrayPrice[lmt]= iOpen ( _Symbol ,Timeframes,lmt); break ; case 3 : ArrayPrice[lmt]= iHigh ( _Symbol ,Timeframes,lmt); break ; case 4 : ArrayPrice[lmt]= iLow ( _Symbol ,Timeframes,lmt); break ; default : ArrayPrice[lmt]= iClose ( _Symbol ,Timeframes,lmt); break ; } switch (AppliedPrice) { case 1 : ArrayPrice[p]= iClose ( _Symbol ,Timeframes,p)*SmoothFactor+ArrayPrice[p+ 1 ]*( 1.0 -SmoothFactor); break ; case 2 : ArrayPrice[p]= iOpen ( _Symbol ,Timeframes,p)*SmoothFactor+ArrayPrice[p+ 1 ]*( 1.0 -SmoothFactor); break ; case 3 : ArrayPrice[p]= iHigh ( _Symbol ,Timeframes,p)*SmoothFactor+ArrayPrice[p+ 1 ]*( 1.0 -SmoothFactor); break ; case 4 : ArrayPrice[p]= iLow ( _Symbol ,Timeframes,p)*SmoothFactor+ArrayPrice[p+ 1 ]*( 1.0 -SmoothFactor); break ; default : ArrayPrice[p]= iClose ( _Symbol ,Timeframes,p)*SmoothFactor+ArrayPrice[p+ 1 ]*( 1.0 -SmoothFactor); break ; } } //for / /------------------------------------------------------------------------------------------------------------- EMA= NormalizeDouble (ArrayPrice[beginbar], _Digits ); if (LineTrend== true ) tooltipema= "Line " +type_ma+ string (InpMAPeriod)+ " " +pr+ "\n" + TimeToString ( iTime ( _Symbol ,Timeframes,beginbar), TIME_DATE | TIME_MINUTES )+ "\n" + DoubleToString (EMA, _Digits ); else tooltipema= "Trend " +type_ma+ string (InpMAPeriod)+ " " +pr+ "\n" + TimeToString ( iTime ( _Symbol ,Timeframes,beginbar), TIME_DATE | TIME_MINUTES )+ "\n" + "Original Price: " + DoubleToString (EMA, _Digits ); if (LineTrend== true ) HLine( 0 ,smaname,tooltipema,time_1,EMA,MAStyle,maWidthAll,ColorLine); else PlotTrend( 0 ,smaname,tooltipema, 0 ,time_1,EMA,time_2,EMA,ColorLine,MAStyle,maWidthAll, true , false , false , true ); ArrayFree (ArrayPrice); //---- } //ema==true } //if(HLines==true) //--- return value of prev_calculated for next call return (rates_total); } //+------------------------------------------------------------------+ //| Вывод горизонтальной линии на график | //+------------------------------------------------------------------+ bool HLine( const long chart_ID= 0 , string name= "" , string tooltip= "" , datetime time= 0 , double price= 0 , int style= STYLE_SOLID , int width= 1 , color clr= clrBlack ) { //--- сбросим значение ошибки ResetLastError (); //--- if (! ObjectCreate (chart_ID,name, OBJ_HLINE , 0 , 0 ,price)) { Print ( __FUNCTION__ , ": не удалось создать горизонтальную линию! Код ошибки = " , GetLastError ()); return ( false ); } ObjectSetInteger (chart_ID,name, OBJPROP_STYLE , style); ObjectSetInteger (chart_ID,name, OBJPROP_WIDTH , width); ObjectSetInteger (chart_ID,name, OBJPROP_COLOR , clr); //--- скроем (true) или отобразим (false) имя графического объекта в списке объектов ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN , true ); ObjectSetString (chart_ID,name, OBJPROP_TOOLTIP ,tooltip); //---- return ( true ); } //+------------------------------------------------------------------+ //| Построение трендовой линии на графике | //+------------------------------------------------------------------+ bool PlotTrend( const long chart_ID= 0 , string name= "" , string tooltip= "" , const int subwindow= 0 , datetime time1= 0 , double price1= 0 , datetime time2= 0 , double price2= 0 , const color clr= clrBlack , const ENUM_LINE_STYLE style= STYLE_SOLID , const int width= 2 , const bool back= true , const bool selection= false , const bool ray= false , const bool hidden= true ) { //---- ResetLastError (); if ( ObjectFind (chart_ID,name)!=subwindow) { if (! ObjectCreate (chart_ID,name, OBJ_TREND ,subwindow,time1,price1,time2,price2)) { Print ( __FUNCTION__ , ": не удалось создать трендовую линию! Код ошибки = " , GetLastError ()); return ( false ); } } else { ObjectMove (chart_ID,name, 0 ,time1,price1); ObjectMove (chart_ID,name, 1 ,time2,price2); } ObjectSetInteger (chart_ID,name, OBJPROP_COLOR ,clr); ObjectSetInteger (chart_ID,name, OBJPROP_STYLE ,style); ObjectSetInteger (chart_ID,name, OBJPROP_WIDTH ,width); ObjectSetInteger (chart_ID,name, OBJPROP_BACK ,back); ObjectSetInteger (chart_ID,name, OBJPROP_SELECTABLE ,selection); ObjectSetInteger (chart_ID,name, OBJPROP_SELECTED ,selection); ObjectSetInteger (chart_ID,name, OBJPROP_RAY ,ray); ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN ,hidden); ObjectSetString (chart_ID,name, OBJPROP_TOOLTIP ,tooltip); //---- return ( true ); } //+------------------------------------------------------------------+ Igor Zakharov 2019.04.23 06:50 #8168 kopeyka2:写了一篇独立的文章。可以工作,但在专家部分持续写出错误。 我的日志是干净的,任意切换了模式(EMA也测试过)。给出一个可能出现错误的设置的变体。 我在想,它怎么可能同时工作和出错。 Maxim Kuznetsov 2019.04.23 07:20 #8169 yiduwi:这很有价值,需要的是)要知道给定的时间是在任何时间框架的条形内,你需要做以下工作 但如果时间是偶数,没有分钟"2019.04.23 01:00:00" ,那么箭头就在两个柱子上,在01:00:00的柱子上,在前一个00:00:00的柱子上,如何不多放一个? if (time[i]>=time_m1 && time[i]<time_m1+PeriodSeconds(PERIOD_M1) { // время time[i] попало внутрь бара открытого в time_m1 } kopeyka2 2019.04.23 08:01 #8170 Igor Zakharov:我有一个干净的日志,任意切换了模式(EMA也测试过)。给出可能出现错误的设置选项。 有趣的是,它可以在工作的同时产生一个错误。 EMA线20 23.04.2019 00:00 当打开MT5时,在没有在线连接的情况下,立即出现 "array out.... "的信息。 误差不同,但总是存在。可以在网上复制,但更多地是在MT开机时出现。 这就是 "百慕大平行四边形 "的神秘之处 1...810811812813814815816817818819820821822823824...1953 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
唯一要做的是增加许多小函数,这些函数将检查一个表达式的相等、减法、加法、不等式、乘法等等。
PS/ 什么是 "检查减法、加法、乘法",我不明白:-(
我怎样才能从更高的时间框架上看到M1的开盘时间?
如果你想从低处看到高处的酒吧,那么
我怎样才能从更高的时间框架上看到M1的开盘时间?
如果你想从低处看到高处的酒吧,那么
如果我没记错的话。
datetime time_h1=iTime(_Symbol,PERIOD_H1,1); // время открытия прошлого бара H1
int bar_m1=iBarShift(_Symbol,PERIOD_M1,time_h1); // соотв. ему бар периода M1
datetime time_m1=iTime(_Symbol,PERIOD_M1,bar_m1); // время его открытия
如果我理解正确,那么。
datetime time_h1=iTime(_Symbol,PERIOD_H1,1); // время открытия прошлого бара H1
int bar_m1=iBarShift(_Symbol,PERIOD_M1,time_h1); // соотв. ему бар периода M1
datetime time_m1=iTime(_Symbol,PERIOD_M1,bar_m1); // время его открытия
假设最后一根柱子H1的开盘时间 是01:00:00,我们如何从01:01: 00开盘的柱子M1中获取时间到time_m1变量?
假设最后一个H1条 在01:00:00开盘,我如何从01:01:00开盘的M1条中获得时间,进入time_m1变量?
time_m1_plus_1=time_h1 + 1 * PeriodSeconds(PERIOD_M1); //突然间 :-) 就在时间上增加1分钟=60秒。
但如果你冒着改变日/会/周或异国货币/指数/基金的风险,为了确定,使用iBarShift,iTime - 因为在体面的地方,酒吧是随着第一笔交易形成的(没有交易量就没有酒吧),但如果没有交易,"快速 "将是
time_m1_plus_1=time_h1 + 1 * PeriodSeconds(PERIOD_M1); //突然间 :-) 就在时间上增加1分钟=60秒。
现在,这很有价值--要知道指定的时间是在任何时间框架的一个条形内,你需要做以下工作
但如果时间是偶数,没有分钟"2019.04.23 01:00:00" ,那么箭头就在两个柱子上,在01:00:00的柱子上,在前一个00:00:00的柱子上,如何不多放一个?
一天中的所有部分和季节都很好))
火鸡写的。它可以工作,但会在专家部分持续写入错误。
尝试解决问题......到目前为止“哪一个到顶部”..)))
告诉我,pliz,我因缺乏经验而搞砸的地方......
我用红色突出显示代码中有问题的地方......或者绿色会更好!?)))
PS我原则上拒绝手柄选项,因为MT5上手柄的工作条件
如果代码有严重的错误,愿意支付一些工资。
但我想了解问题的本质!!!!
写了一篇独立的文章。可以工作,但在专家部分持续写出错误。
我的日志是干净的,任意切换了模式(EMA也测试过)。给出一个可能出现错误的设置的变体。
我在想,它怎么可能同时工作和出错。
这很有价值,需要的是)要知道给定的时间是在任何时间框架的条形内,你需要做以下工作
但如果时间是偶数,没有分钟"2019.04.23 01:00:00" ,那么箭头就在两个柱子上,在01:00:00的柱子上,在前一个00:00:00的柱子上,如何不多放一个?
if (time[i]>=time_m1 && time[i]<time_m1+PeriodSeconds(PERIOD_M1) {
// время time[i] попало внутрь бара открытого в time_m1
}
我有一个干净的日志,任意切换了模式(EMA也测试过)。给出可能出现错误的设置选项。
有趣的是,它可以在工作的同时产生一个错误。
EMA线20 23.04.2019 00:00
当打开MT5时,在没有在线连接的情况下,立即出现 "array out.... "的信息。
误差不同,但总是存在。可以在网上复制,但更多地是在MT开机时出现。
这就是 "百慕大平行四边形 "的神秘之处