[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ELA question on HighD, LowD, etc.



PureBytes Links

Trading Reference Links

I wonder if anyone on the list has had this problem.

I'm trying to get a HighD and LowD (and corresponding functions) to 
work on intraday data where they are called repeatedly in the same 
bar.  After looking at the Omega code for these functions, it appears 
that they won't work properly when called multiple times in a bar.  
Or am I wrong about that?  What follows is an example of the problem 
I'm having.  Any suggestions would be appreciated.

How Do I make this function work?  There appears to be some problem
with HighD (and LowD) in that it doesn't properly keep track of the Hi
of the day when repeatedly called from the same bar.

I'm trying to accomplish something similar to AvgTrueRange, but using
intraday data, but having the Avg range be calculated on the basis of
the range for a day, not for a bar.

What can I do?

This is the function:

{Function: AvgDailyRange}
{Purpose: to calculate the average for the specified day using intra
day data} inputs:  RangeLen(NumericSimple) ; Variables: AvgTemp(0),
High1(0), Lo1(0); AvgTemp = 0; For Value1 = 1 to RangeLen begin
 High1 = HighD(Value1); 
 Lo1 = LowD(Value1); 
 {Here, the High1 and Lo1 are staying the same thru the loop }
 print("Dates=",Date:4:0,Date[Value1]:4:0,"Value1=",Value1:2:0,"High1=
 ",High1,"Lo1=",Lo1,"Diff=",High1-Lo1); AvgTemp = AvgTemp + ( High1 -
 Lo1 );
end;
print("   AvgTemp = ",AvgTemp,"AvgTemp/RangeLen=",AvgTemp/RangeLen);
AvgDailyRange = AvgTemp/RangeLen;

TIA,

Cash