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

 
Alex:

谢谢你的回答和耐心。


弗拉基米尔,我可能已经让你厌烦了:)但我对基本的东西感到很难受。我试图用Copy函数做一个测试任务...指标没有画出来,尽管在普林特有数字。我什么都不明白。


一个相同的数组UpBar进入了两个缓冲区:0和1。

对于你不想设置值的索引,写空值。

而且,据我所知,你写的是3到3条的数值。这意味着最早的数值将被写入,而不是最新的(编号顺序与mql4不同)。

 
Alex:

谢谢你的回答和耐心。


弗拉基米尔,我可能已经让你厌烦了:)但我对基本的东西感到很难受。我试图用Copy函数做一个测试任务...指标没有画出来,尽管在普林特有数字。我什么都不明白。


//+------------------------------------------------------------------+
//|                                                        PBars.mq5 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots   1
//--- plot UpBar
#property  indicator_label1  "UpBar"
#property  indicator_type1   DRAW_HISTOGRAM
#property  indicator_color1  clrGreen
#property  indicator_style1  STYLE_SOLID
#property  indicator_width1  6
////--- plot DnBar
//#property indicator_label2  "DnBar"
//#property indicator_type2   DRAW_HISTOGRAM
//#property indicator_color2  clrRed
//#property indicator_style2  STYLE_SOLID
//#property indicator_width2  6
//--- input parameters
input int   Histori=30;
input ENUM_TIMEFRAMES TimeFrame=0;
input string  Simvol="EURUSD";
//--- indicator buffers
double         UpBar[];
//double         DnBar[];
double         O_Price[];
double         C_Price[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,UpBar,INDICATOR_DATA);
//SetIndexBuffer(1,UpBar,INDICATOR_DATA);
   SetIndexBuffer(1,O_Price,INDICATOR_CALCULATIONS);
   SetIndexBuffer(2,C_Price,INDICATOR_CALCULATIONS);
//---
   ArraySetAsSeries(O_Price,true);
   ArraySetAsSeries(C_Price,true);
   ArraySetAsSeries(UpBar,true);
   ArrayInitialize(UpBar,0.0);
//---
   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[])
  {
   ArraySetAsSeries(open,true);
   ArraySetAsSeries(close,true);

   if(prev_calculated==0)
     {
      ArrayInitialize(UpBar,0.0);
      ArrayInitialize(O_Price,0.0);
      ArrayInitialize(C_Price,0.0);
      Print(__FUNCTION__);
      ResetLastError();
      if(CopyOpen(Simvol,TimeFrame,0,Histori,O_Price)==-1)
         Print("Error CopyOpen #",GetLastError());
      ResetLastError();
      if(CopyClose(Simvol,TimeFrame,0,Histori,C_Price)==-1)
         Print("Error CopyClose #",GetLastError());
      for(int t=3; t<Histori; t++)
        {
         UpBar[t]=MathAbs(NormalizeDouble((O_Price[t]-C_Price[t]),Digits()));
         Print(IntegerToString(t)," ",DoubleToString(UpBar[t],Digits()));
         int g=0;
        }
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+

而结果是。

结果

 
Karputov Vladimir:

而结果是。


再次,非常感谢你。
 
Alex:
再次,非常感谢你。
不客气。如果您有任何关于MQL5的问题,请不要犹豫,与我联系。
 

在MQL4中,是否有任何函数可以在给定的条数 下给出最高/最低价格值?

我想有一个,但我找不到了......。

 
-Aleks-:

在MQL4中,是否有任何函数可以在给定的条数 下给出最高/最低价格值?

我想有一个,但我找不到了......

https://docs.mql4.com/ru/series/ihighest

https://docs.mql4.com/ru/series/ilowest

iHighest - Доступ к таймсериям и индикаторам - Справочник MQL4
iHighest - Доступ к таймсериям и индикаторам - Справочник MQL4
  • docs.mql4.com
iHighest - Доступ к таймсериям и индикаторам - Справочник MQL4
 
是的,是的,谢谢--我没有认真找--我自己已经找到了。
 
-Aleks-:
是的,谢谢你--我没有认真找--我自己已经找到了。
与mql5兼容的函数CopyHighCopyLow 然后在产生的数组中ArrayMaximumArrayMinimum
 
构成交易系统的每一组变量的利润和损失都是随机分布的,这是真的吗?
 
Евгений:
构成交易系统的每一组变量的利润和损失都是随机分布的,这是真的吗?

一个反面的问题。

你认为任何货币对的走势:图表、买入和卖出价格等,都取决于你的一组变量?