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

Re: Plotting moving ave data for overnight NAZDAQ mini symbol



PureBytes Links

Trading Reference Links

At 4:20 PM -0500 11/14/01, Jim Erven wrote:

>My Tradestation 4 ELA PowerEditor doesn't like Ave1 as a variable. U working
>in Tradestation4 or Tradestation2000?

There were a couple of typos. The following verifies OK on TS4.0.

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)),
      Count(0);


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;