PureBytes Links
Trading Reference Links
|
At 11:32 AM -0500 11/14/01, Jim Erven wrote:
>Yes thats the problem, the code retains the overnight value of the NDX, but
>uses the overnight values of the NQ1Z. I just wondered if there was any way
>to just stop the calculation from using the overnight data.
There is a pretty simple way for the XAverage (but not for the WAverage). I noticed that Length1 was only 2 so just delayed plotting WAverage on each new day until the second bar of the new day ...
So try the code below. (Not tested) I included a "simple" (as opposed to "series") version of the XAverage code in-line. This code totally disregards the bars other than during the day session.
Plot points on the price scale to avoid plotting during the overnight session.
Bob Fulks
-----
Input: Length1(2), Length2(9), Length3(200);
Vars: Price((3 * C of data1 + H of data1 + L of data1)/5 -
(3 * C of data2 + H of data2 + L of data2)/5);
Vars: Ave1((3 * C of data1 + H of data1 + L of data1)/5 -
3 * C of data2 + H of data2 + L of data2)/5);
Vars: Ave2((3 * C of data1 + H of data1 + L of data1)/5 -
3 * C of data2 + H of data2 + L of data2)/5);
Vars: Ave3((3 * C of data1 + H of data1 + L of data1)/5 -
3 * C of data2 + H of data2 + L of data2)/5);
Vars: Factor2(2 / (Length2 + 1)),
Factor3(2 / (Length3 + 1));
if Time >= 0930 and Time <= 1600 then begin
{Count bars in the day}
Count = iff(Date <> Date[1], 1, Count + 1);
Price = (3 * C of data1 + H of data1 + L of data1)/5 -
(3 * C of data2 + H of data2 + L of data2)/5;
Ave1 = WAverage(Price, Length1);
Ave2 = Factor2 * Price + (1 - Factor2) * Ave2;
Ave3 = Factor3 * Price + (1 - Factor3) * Ave3;
if Count >= Length1 then Plot1(Ave1,"AvgWghtd");
Plot2(Ave2,"AvgExp");
Plot3(Ave3,"SimpleAvg");
end;
|