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

 
Fast528:

我已经有一段时间没有优化过任何东西了。

结果栏是什么意思? 我搞不清楚。

10K的测试是


这要么是一个自定义的标准,要么只是预期列表中的一个标准,在标有 "优化 "的设置对面。

 
Aleksey Vyazmikin:

这要么是一个自定义的标准,要么只是预期列表中的一个标准,在标有 "优化 "的设置对面。

无所不晓)

在利润中出现了一个小的负数,在结果一栏中略低于起始金额

 
Fast528:

无所不晓)

其中利润略微减去,在结果一栏中略低于起始金额

 
Aleksey Vyazmikin:

谢谢,我明天会去看看。

 
Fast528:

谢谢,我明天会去看看。

乐于助人。

 
请教如何找出图表上的价格上限和下限,在任何时候都可以直观地观察到?
 
Aleksey Vyazmikin:
请告知如何找出图表价格的最大值和最小值,目前可以直观地观察到?

图表_价格_最小值

图表_prmin

双重R/O修改器 - 子窗口编号

最高价格

图表最大值

双重R/O修改器 - 子窗口编号

 
Vladimir Karputov:

图表_价格_最小值

图表_prmin

双重R/O修改器 - 子窗口编号

最高价格

图表最大值

双重R/O修改器 - 子窗口编号

谢谢你!

我的理解是,这些数值只能在当前的图表上获得,而要获得历史信息,我应该一步一步地将图表逐条移动?

 
Aleksey Vyazmikin:

谢谢你!

我的理解是,这些数值只能在当前的图表上获得,如果要获得历史上的信息,你需要一次一次地移动图表?

你可以使用OnChartEvent 和CHARTEVENT_CHART_CHANGE事件标识符--图表的任何变化。你可以在一个定时器中检查它(例如每秒一次)。

下面是一个基于OnChartEvent和CHARTEVENT_CHART_CHANGE事件标识符的例子。

//+------------------------------------------------------------------+
//|                                             CHART_PRICE_xxxx.mq5 |
//|                              Copyright © 2018, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2018, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
#property indicator_chart_window
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//---

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
   if(id==CHARTEVENT_CHART_CHANGE)
     {
      string text=(DoubleToString(ChartPriceMax(0,0),Digits())+"\n"+
                   DoubleToString(ChartPriceMin(0,0),Digits()));
      Comment(text);
     }
  }
//+----------------------------------------------------------------------+ 
//| Gets the value of chart minimum in the main window or in a subwindow | 
//+----------------------------------------------------------------------+ 
double ChartPriceMin(const long chart_ID=0,const int sub_window=0)
  {
//--- prepare the variable to get the result 
   double result=EMPTY_VALUE;
//--- reset the error value 
   ResetLastError();
//--- receive the property value 
   if(!ChartGetDouble(chart_ID,CHART_PRICE_MIN,sub_window,result))
     {
      //--- display the error message in Experts journal 
      Print(__FUNCTION__+", Error Code = ",GetLastError());
     }
//--- return the value of the chart property 
   return(result);
  }
//+----------------------------------------------------------------------+ 
//| Gets the value of chart maximum in the main window or in a subwindow | 
//+----------------------------------------------------------------------+ 
double ChartPriceMax(const long chart_ID=0,const int sub_window=0)
  {
//--- prepare the variable to get the result 
   double result=EMPTY_VALUE;
//--- reset the error value 
   ResetLastError();
//--- receive the property value 
   if(!ChartGetDouble(chart_ID,CHART_PRICE_MAX,sub_window,result))
     {
      //--- display the error message in Experts journal 
      Print(__FUNCTION__+", Error Code = ",GetLastError());
     }
//--- return the value of the chart property 
   return(result);
  }
//+------------------------------------------------------------------+
附加的文件:
 
Vladimir Karputov:

可以基于OnChartEvent和CHARTEVENT_CHART_CHANGE事件标识符--任何图形变化。可以在一个定时器中检查(例如每秒一次)。

下面是一个基于OnChartEvent和CHARTEVENT_CHART_CHANGE事件标识符的例子。

谢谢你!