任何菜鸟问题,为了不给论坛添乱。专业人士,不要路过。没有你就无处可去 - 6. - 页 686

 

下午好。如何使用指标在终端数据窗口中以 "yyyy.mm.dd "和 "hh:mi "的格式显示酒吧时间。

指示器缓冲区 可以显示从1970年1月1日00:00起的秒数,也可以显示转换后的时间(TimeToStr)。

或截断的日期或时间。需要一些建议,提前感谢!

 

#property strict应该被添加,之后,即使没有转换,日期输出也将是 "yyyy.mm.dd hh:mm:ss "格式。

TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS)

 

你的名字是 "Evillive"。

看起来没那么简单,还是有什么我不明白的地方?

作为一个版本,狗被埋在指标缓冲区 中,因为它是一个类型的双倍。

//+------------------------------------------------------------------+
//|                                                   WinData_v1.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2

string g_DataTimeValue;

double WinDataBuffer[];
double WinNumberBarBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   IndicatorDigits(0);//(8)

   SetIndexBuffer(0,WinDataBuffer);
   SetIndexStyle(0,DRAW_NONE);

   SetIndexBuffer(1,WinNumberBarBuffer);
   SetIndexStyle(1,DRAW_NONE);

   SetIndexLabel(0,"WinDataTime");
   SetIndexLabel(1,"№ Bara");

//---
   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[])
  {
//---
   for(int i=0; i<100; i++)
     {

      g_DataTimeValue=TimeToString(time[i],TIME_DATE|TIME_SECONDS);

      WinDataBuffer[i]=TimeToString(time[i],TIME_DATE|TIME_SECONDS);
      WinNumberBarBuffer[i]=i;
      // WinDataBuffer[i]=StrToDouble(g_DataTimeValue);

      Print(" WinDataBuffer[i] = ",WinDataBuffer[i],"  WinNumberBarBuffer[i] = ",WinNumberBarBuffer[i],
            "  g_DataTimeValue = ",g_DataTimeValue);

     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Принт:


2014.08.11 15:39:54.016 WinData_v1 EURUSD,M1:  WinDataBuffer[i] = 2014.08  WinNumberBarBuffer[i] = 99.0  g_DataTimeValue = 2014.08.06 11:41:00



 

下午好,同志们!

这是第一次上论坛,如果这是一个老生常谈的问题,请不要踢我......。

如何在一定的时间间隔(例如每分钟)后循环打开交易?

预先谢谢你
 
vld:

你的名字是 "Evillive"。

看起来没那么简单,还是有什么我不明白的地方?

作为一个版本,狗被埋在指标缓冲区中,因为它是一个类型的双倍。


为什么要把字符串放在指标缓冲区 里?
 
Sanyo:

下午好,同志们!

这是第一次上论坛,如果这是一个老生常谈的问题,请不要踢我......。

如何在一个周期内以一定的时间间隔(例如每分钟)开立交易?

预先感谢你。

通过检查适当的TF!的新条 的开放。
 
Sanyo:

下午好,同志们!

这是第一次上论坛,如果这是一个老生常谈的问题,请不要踢我......。

如何在一个周期内以一定的时间间隔(例如每分钟)开立交易?

预先感谢你。
阅读关于 OnTimer()
 

你好,我有这样的问题。

MT4在优化专家方面有很大的可能性,但有没有优化指标的工具?如果我想优化 一个指标的参数,使其读数达到最大限度的 "正确",是否只有在其基础上编写一个电子图表,并通过历史记录来运行?

我还想知道,MT-4是否像MT5那样有一个优化专家顾问的自定义标准?

 

伙计们,我忘了...

如何获得一个当前订单的数组并循环浏览。并循环获得订单信息。MT4,谢谢...

 
Vinin:

还有,为什么要把字符串放在指标缓冲区里?

我理解这种行为的荒谬性,但我不明白如何使用这个指标

在终端数据窗口中以 "yyyy.mm.dd "和 "hh:mi "的格式显示酒吧时间(作为终端数据窗口的第一和第二行)。

指示器缓冲区 将通过分配给它time[i]来输出从1970年1月1日00:00开始的秒数时间。

或转换后(TimeToString)截断的日期或时间。

如果有可能使用自定义的MQL工具来显示,请告知如何做。 提前感谢!