初学者的问题 MQL5 MT5 MetaTrader 5 - 页 1229

 
Elena Baranova:

尊敬的专业人士,请您告诉我们是否有可能在顾问的代码中获得一周时间框架的RSI值,但要计算一周的值,这不是从星期一开始,而是从星期三开始(即从星期三到下星期三的一周)。据我所知,它不能用iRSI做?

到目前为止,我只能看到一个自己写代码来计算的方法。是否有更简单的解决方案或现成的解决方案?

如果你在W1时间框架上创建一个指标手柄,这意味着该指标将在W1条上计算:一个条,一个星期。

你需要在D1时间段(日线时间段)创建一个指标手柄。


一般来说,"(即从周三到下周三的一个星期)"这句话的意思并不明确。一周中的哪一天开始没有区别--指标是按条形计算的。

 
Vladimir Karputov:

如果 在W1时间框架上创建一个指标句柄,这意味着该指标将在W1条上进行计算:一个条,然后一个星期。

你需要在D1时间段(日线时间段)创建一个指标手柄。


一般来说,"(即从周三到下周三的一个星期)"这句话的意思并不明确。哪一天是一周的开始并不重要--该指标是用条形计算的。

我理解关于酒吧的一切。但所有的周报都是从周一开始的。因此,为了得到例如从周三到周三的一周,我想我应该根据日线写出自己的代码。

我也不完全理解这种计算的意义,但客户问了。

 
Elena Baranova:

我理解所有关于酒吧的事情。但所有的周报都是从周一开始的。因此,为了获得从周三到周三的周数,我想我必须根据日线来写我自己的代码。

我也不完全理解这种计算的意义,但我的客户要求我这样做。

专家顾问根据RSI值开启交易。我不明白这种计算的全部意义,但客户要求这样做,EA只在周一新的周线开盘时打开订单。

 
Elena Baranova:

我理解所有关于酒吧的事情。但所有的周报都是从周一开始的。因此,为了获得从周三到周三的周数,我想我必须根据日线来写我自己的代码。

我也不完全理解这种计算的意义,但客户要求我这样做。

我无法理解其物理意义。因此,我要离开。

 

帮助解决在MT5中显示图表的问题。 图表一直在更新并向左拖动。而这是在所有的乐器上。

再往后,它一直在向最大的历史转变。一般来说,它不能正确显示上周的信息。最后一天的蜡烛不断消失,它闪烁并向左移动。如何解决这个问题?

 
Александр:

帮助解决MT5中图表显示的问题。 图表一直在更新并向左拖动。而这是在所有的乐器上。

它不断地转移到最大的历史。一般来说,它不能正常显示最近一周的信息。 最后一天的烛台不断消失,它闪烁并向左移动。如何解决这个问题?

这只是一台时间机器 :)

也许你有一些脚本/顾问/指标在运行--它们可以转移图表。

 
Александр:

帮助解决MT5中图表显示的问题。 图表一直在更新并向左拖动。而这是在所有的乐器上。

它不断地转移到最大的历史。一般来说,它不能正常显示最近一周的信息。 最后一天的烛台不断消失,它闪烁并向左移动。如何解决这个问题?

删除正在运行的指标和EA。把猫从键盘上移开。清洁键盘上溢出的任何咖啡。

 
Vladimir Karputov:

拆除运行中的指示灯和顾问。从键盘上取下猫。清洁键盘上溢出的任何咖啡。

谢谢你的建议。问题解决了,只是必须选择一个高ping 的服务器。

 

请解释为什么蓝色区域没有阴影?以及如何解决这个问题?
是否有可能在一个指标中产生两个直方图?

#property indicator_chart_window                   
#property indicator_buffers   8                    
#property indicator_plots     8                    

#property indicator_color1    clrRed                
#property indicator_style1    STYLE_SOLID          
#property indicator_color2    clrRed               
#property indicator_style2    STYLE_SOLID          
#property indicator_color3    clrRed               
#property indicator_style3    STYLE_DOT            

#property indicator_color5    clrDodgerBlue        
#property indicator_style5    STYLE_SOLID          
#property indicator_color6    clrDodgerBlue        
#property indicator_style6    STYLE_SOLID          
#property indicator_color7    clrDodgerBlue        
#property indicator_style7    STYLE_DOT            

double
   Line_High_Up[], Line_High_Dn[], Hist_High_Up[], Hist_High_Dn[],
   Line_Low_Up[],  Line_Low_Dn[],  Hist_Low_Up[],  Hist_Low_Dn[];
   

void OnInit() 
   { 
   SetIndexBuffer     (0, Line_High_Up,      INDICATOR_DATA); 
   PlotIndexSetInteger(0, PLOT_DRAW_TYPE,    DRAW_LINE);      
   SetIndexBuffer     (1, Line_High_Dn,      INDICATOR_DATA); 
   PlotIndexSetInteger(1, PLOT_DRAW_TYPE,    DRAW_LINE);      
   SetIndexBuffer     (2, Hist_High_Up,      INDICATOR_DATA); 
   PlotIndexSetInteger(2, PLOT_DRAW_TYPE,    DRAW_HISTOGRAM2);
   SetIndexBuffer     (3, Hist_High_Dn,      INDICATOR_DATA);

   SetIndexBuffer     (4, Line_Low_Up,       INDICATOR_DATA);
   PlotIndexSetInteger(4, PLOT_DRAW_TYPE,    DRAW_LINE);     
   SetIndexBuffer     (5, Line_Low_Dn,       INDICATOR_DATA);
   PlotIndexSetInteger(5, PLOT_DRAW_TYPE,    DRAW_LINE);     
   SetIndexBuffer     (6, Hist_Low_Up,       INDICATOR_DATA);
   PlotIndexSetInteger(6, PLOT_DRAW_TYPE,    DRAW_HISTOGRAM2);
   SetIndexBuffer     (7, Hist_Low_Dn,       INDICATOR_DATA);
   }


int OnCalculate(  const int         rates_total,      
                  const int         prev_calculated,  
                  const datetime   &time[],                   
                  const double     &open[],                     
                  const double     &high[],                     
                  const double     &low[],                      
                  const double     &close[],                    
                  const long       &tick_volume[],                
                  const long       &volume[],                     
                  const int        &spread[]   )                   
   {  
   int i;
   for(i=prev_calculated; i<=rates_total-1; i++)      
      {
      Line_High_Dn[i] = Hist_High_Dn[i] = high[i];
      Line_High_Up[i] = Hist_High_Up[i] = Line_High_Dn[i] + 20*_Point;

      Line_Low_Up[i]  = Hist_Low_Up[i]  = low[i];
      Line_Low_Dn[i]  = Hist_Low_Dn[i]  = Line_Low_Up[i] - 20*_Point;
      }
   return(i-1);
   }           
 
User_mt5:

请解释为什么蓝色区域没有阴影?以及如何解决这个问题?
是否有可能在一个指标中输出两个直方图?

如果两个直方图的厚度都设置为'3'的话

//+------------------------------------------------------------------+
//|                                                            2.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   2
//--- plot Hist_High
#property indicator_label1  "Hist_High"
#property indicator_type1   DRAW_HISTOGRAM2
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot Hist_Low
#property indicator_label2  "Hist_Low"
#property indicator_type2   DRAW_HISTOGRAM2
#property indicator_color2  clrBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- input parameters
input int      Input1=9;
//--- indicator buffers
double         Hist_HighBuffer1[];
double         Hist_HighBuffer2[];
double         Hist_LowBuffer1[];
double         Hist_LowBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Hist_HighBuffer1,INDICATOR_DATA);
   SetIndexBuffer(1,Hist_HighBuffer2,INDICATOR_DATA);
   SetIndexBuffer(2,Hist_LowBuffer1,INDICATOR_DATA);
   SetIndexBuffer(3,Hist_LowBuffer2,INDICATOR_DATA);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int limit=prev_calculated-1;
   if(prev_calculated==0)
      limit=0;
   for(int i=limit; i<rates_total; i++)
     {
      Hist_HighBuffer1[i]=high[i]+20.0*Point();
      Hist_HighBuffer2[i]=high[i];
      Hist_LowBuffer1[i]=low[i];
      Hist_LowBuffer2[i]=low[i]-20.0*Point();
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+



附加的文件:
2.mq5  3 kb