PureBytes Links
Trading Reference Links
|
I usually use the following:
Var: NewBar(FALSE);
NewBar = Time data2 = Time data1;
if NewBar then begin
Tavg = Jrc.jma.2k(Price,Len,Speed);
end;
The variable "NewBar" is true when there is a bar in both data series.
So by using NewBar as a filter, you execute the average function only on the
bars of data2.
The average function must be a "simple" function (not a "series" function)
for this to work. I do not know if Jrc.jma.2k is a "simple" function but I
am sure Jurik supplies one.
Bob Fulks
At 06:39 PM 9/28/2004, you wrote:
>I am attempting to do a calculation based on a higher time frame ( daily
>data using Data2 ) from within an indicator plotted on a lower time frame
>chart(45 min data1). It is essentially a moving average of the higher time
>frame which I am plotting on the lower time frame. I put in some logic to so
>it skips the calculation if the higher time frame is still on the same bar
>but it still does not calculate properly even tho I have verified the logic
>works properly by putting a print statement in the loop. I remember seeing
>this before. Does anyone know what the solution is ? Below is a snipit of
>the logic.
>
>Input: Price(Close of data2);
>Vars:Init(True);
>
>If Init then begin
> Init=False;
> Cbar=CurrentBar of Data2;
> end;
>
>If CBar< CurrentBar of Data2 then Begin
> Tavg=Jrc.jma.2k(Price,Len,Speed);
> Print(Date,time); { This is to check logic }
> CBar=CurrentBar of data2;
> end;
|