如何指代一个特定的时间 - 页 2

 
大家好

我可能在这里混淆了话题,但让我这样重新表述我的标题/问题

如果我想找到一个特定时间的蜡烛,例如(我如何找到上午7:00的蜡烛的high[],low[]close[],open[]),MT4图表默认显示收盘蜡烛和开盘时间,所以让我们使用这个。

Print(high[], " 7:00am的蜡烛的高点)。
Print(low[], " 早上7点的蜡烛的低点)。

所以我想找到某个特定时间的高点和低点的蜡烛。

一旦我找到这一点,我就想根据我刚找到的起点和起始蜡烛来设置一个交易的时间范围。

总之,我认为我可以通过你们发布的信息来实现这一目标,并在此基础上进行管理,但我可能对我的问题描述有误。

一旦我完成了,我会把代码发回来给大家看,也许到时候可以用。

谢谢大家
 
RaptorUK:

没有,因为Time[x]返回的是一个日期时间......但你可以做到 ......

阅读关于TimeHour 的内容


它是如何知道18的?
if(TimeHour(Time[1]) >= 18

我有点明白TimeHour,但Time[1]是数据时间,为什么不需要转换呢?

我假设TimeHour是为我做的,我将设置一个打印语句,以便我可以尝试看看它在做什么。

很抱歉,这么长时间以来我一直在问这些简单的问题,但我还是很难理解其中的一些功能。

 
我的打印报表应该在7点打印吗?

if(TimeHour(Time[1]) == 7)
   {
   Print(TimeHour(Time[1]), " Time [1] what is this time");
   }

2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] What is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:10 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.18 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:44 2011.11.11 08:11 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:43 2011.10.28 08:08 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
2011.12.15 19:14:42 2011.10.14 08:09 Time_sampling EURUSD,M15: 7 Time [1] what is this time
 
Agent86:

所以我想找到某支蜡烛在某个特定时间的高点和低点。

使用iBarShift,它 "通过开放时间搜索酒吧。"然后它... "返回指定开放时间的酒吧转移。"你必须给它一个日期时间。

.. . . 所以你如何计算出你想要的小时的日期时间? 好吧,我们假设你要的是今天早上7点 . . . (现在是上午9:30)取TimeCurrent()(这是服务器时间,所以与你的本地时间相比,可能会有时间偏移,你需要把这个因素考虑进去),然后除以天数(PERIOD_D1 * 60),再取MathFloor值,这样就得到了午夜这个日期时间 . . . . 加上7小时(7 * 60 * 60),就得到7am这个日期时间。

 
Agent86:

它是如何知道18的?

我得到了TimeHour,但是Time[1]是数据时间,为什么不需要转换呢?

我不知道为什么你对文件 有这样的问题 ......你能解释一下吗? 对我来说,在这种情况下,它是非常清楚的......是的,我同意,对于一些函数,文档可以留下很多需要改进的地方......但是......

int TimeHour(datetime time)

返回指定时间的小时数。

int= 该函数返回什么类型的变量

datetime time= 当你调用该函数时需要传递什么类型的数据

返回指定时间的小时数。 = 函数的作用。

 
Agent86:
我的打印语句应该是在7点打印吗?

是的,应该是这样的 ...... 你是在H1图表上吗? 所以Time[1]返回最后一个完整的蜡烛的时间 ...... 如果当前时间 是08:11,那么当前的 H1蜡烛是早上8点,那么前一个是早上7点 ...... 不是吗?

 
RaptorUK:

是的,它应该如此 ...... 你是在H1图表上吗? 所以Time[1]返回最后一个完整的蜡烛的时间 ...... 如果当前时间是08:11,那么当前的 H1蜡烛是早上8点,所以前一个是早上7点 ...... 不是吗?

大笑,好吧,我是在15分钟的图表上,所以我知道为什么它现在会以这种方式打印出来。
好吧,我也会再看看iBarShift的。

谢谢。
 

嗨,我也在寻找一个线索,以获得当天第一条的数据。

我做的这段代码,肯定是行不通的。

double nyitohigh; // 第一个条形图的高值

double nyitolow; // 第一根柱子的低值


datetime ejfel = D'TimeYear().TimeMonth().TimeDay() 00:00'; //我们得到了午夜。

int shift=iBarShift(NULL,PERIOD_M15,ejfel,true); //得到从现在开始的转移。

nyitohigh=iHigh(NULL,PERIOD_M15,shift); //获取高点。

nyitolow=iLow(NULL,PERIOD_M15,shift); //获取低点。

我用Comment("Nyito teteje",nyitohigh," Nyito alja",nyitolow)检查了一下;但它在注释中写的是0和0。

你有什么好的提示吗?

Agent86:
大笑,好吧,我是在15分钟的图表上,所以我知道为什么它现在这样打印出来了 好吧,我也会再次审查iBarShift 谢谢。





 
Szilar:

你有什么好的提示吗?


你不能这样做 . . .

datetime ejfel = D'TimeYear().TimeMonth().TimeDay() 00:00'; //we get midnight   <---  no you don't !

. . . 阅读关于数据时间 的文档 尤其是 的最后一句话。

 

你好。

已解决。

double nyitohigh;

double nyitolow;


datetime ejfel = StrToTime("00:00");

int shift=iBarShift(NULL,PERIOD_M15,ejfel,true)。

nyitohigh=iHigh(NULL,PERIOD_M15,shift)。

nyitolow=iLow(NULL,PERIOD_M15,shift)。

Szilar:

嗨,我也在寻找一个线索,以获得当天第一条的数据。

我做的这段代码,肯定是行不通的。

double nyitohigh; // 第一个条形图的高值

double nyitolow; // 第一根柱子的低值


datetime ejfel = D'TimeYear().TimeMonth().TimeDay() 00:00'; //我们得到了午夜。

int shift=iBarShift(NULL,PERIOD_M15,ejfel,true); //得到从现在开始的转移。

nyitohigh=iHigh(NULL,PERIOD_M15,shift); //获取高点。

nyitolow=iLow(NULL,PERIOD_M15,shift); //获取低点。

我用Comment("Nyito teteje",nyitohigh," Nyito alja",nyitolow)检查了一下;但它在注释中写的是0和0。

你有什么好的提示吗?