来自一个 "傻瓜 "的问题 - 页 260

 
zfs:
我怎样才能得到零条的时间?

加上这个。

Print(time[0]);
 
DC2008:

加上这个。

日期为1970年。这个设计也是。

datetime Time[1];
CopyTime(_Symbol,_PERIOD_,0,1,Time);
 
zfs:

它给出了1970年。这个设计也是。

这不会给1970年

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(time,true);
   Print(time[0]);
//--- return value of prev_calculated for next call
   return(rates_total);
  }
 
DC2008:

不会让1970年就这样消失

费率_总数在最后
 
zfs:

这个建筑也是。

你必须这样去做。

   datetime Time[1];
   CopyTime(NULL,0,0,1,Time);
   Print(Time[0]);
 
DC2008:

必须是这样的

它是一样的,但它仍然是1970年的。没有说谎,拿出2次,只是感到困惑)。
 
zfs:
它是一样的,但它仍然是1970年的。没有说谎,输出了2次,只是被搞糊涂了)。

复制整个代码。

#property indicator_chart_window
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
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(time,true);
   Print(time[0]);
   datetime Time[1];
   CopyTime(NULL,0,0,1,Time);
   Print(Time[0]);
   return(rates_total);
  }

这对我来说是有效的!

 
DC2008:

复制整个代码。

这对我来说很有效!

是的,是的,抱歉和感谢,我有几个变量的输出,有一行是空的,所以我弄糊涂了)
 
profit1=profit1+"\n";
有没有可能把这条线转到一个新的线上,它的结果是0。
 
zfs:
有没有可能把这一行转到一个新的行里,这样它就会给出0。

把这些线换掉。

   profit1="\n"+profit1;