indicator timeframes and calculate method
indicator timeframes and calculate method
21 Sep 2013, 03:25
I use a time frame of 5min and a simple average of 1h and need to check the value of my simple average in the caltulate method on every tick.
it's possible ? and which value it will return if we suppose we are at 16h15 ?
than you
Replies
Yassine_Mestari
21 Sep 2013, 14:39
RE: RE:
hichem said:
Hello and welcome to ctdn.
I use a time frame of 5min and a simple average of 1h and need to check the value of my simple average in the caltulate method on every tick.
Actually the Calculate() methode gets fires on each tick. you can get the last value of your simple moving average by calling the .LastValue property on you moving average object.
it's possible ? and which value it will return if we suppose we are at 16h15 ?
The value returned will depend on the price at that hour. It is not fixed.
thank you for your quick answer.
That's mean the last value for my 1h moving average at 16h15 will be its value of 16h right ? and we there is no solution to find if the 1h moving average is raising or failling à 16h15, not before 17h ?
@Yassine_Mestari
hichem
21 Sep 2013, 17:30
RE: RE: RE:
That's mean the last value for my 1h moving average at 16h15 will be its value of 16h right ? and we there is no solution to find if the 1h moving average is raising or failling à 16h15, not before 17h ?
No, at each moment if you inspect the value of MovingAverage.LastValue it gives you the last value at the last tick.
@hichem
Yassine_Mestari
21 Sep 2013, 19:11
if i understand your answer : at 16h15 the simple average of 1h for 3 periode will be the average of the values of (14h15 , 15h15 and 16h15 ) and not values ( 14h , 15h , 16h) ?
@Yassine_Mestari
Yassine_Mestari
21 Sep 2013, 19:51
perfect !! it's exactly what i nead to know.
so there is no way to know at 16h15 if my simple average is falling o raising, not before 17h?
because my real problem ,i want to detect if at 16h my moving average is top , the only way i have is to wait the next value(17h) and if it's failing i can deduce tha t there were a top at 16h?
is there a way to know it before 17h because one hour is a big delay to take decision
thank you a lot
@Yassine_Mestari
bp2012
21 Sep 2013, 20:23
If you're looking at a small period moving average (like 3 periods), it's going to fluctuate significantly with the change in price. For example at 16:15 the moving average turns down, it might look like you've hit a peak, then in the last 10 minutes of the hour a huge spike jumps the price up. Then your moving average no longer looks like a peak. Your peak gets erased and it looks like an increasing line.
The situation you are experiencing is one of the reasons that backtesting using only the bar close can give you very different results than backtesting using tick data. Your indicators can change significantly between the open and close of each bar.
Hope that helps and best of luck in your indicator development.
-bp
@bp2012
Yassine_Mestari
21 Sep 2013, 20:47
yes you're right but it was just an example to simplify with 3, periods.
conclusion , no way to detect the trend before the next period
thank you
@Yassine_Mestari
hichem
21 Sep 2013, 13:11
RE:
Hello and welcome to ctdn.
Actually the Calculate() methode gets fires on each tick. you can get the last value of your simple moving average by calling the .LastValue property on you moving average object.
The value returned will depend on the price at that hour. It is not fixed.
@hichem