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

Continued issue of EL and data2



PureBytes Links

Trading Reference Links

Thanks Wayne for your expanded analysis of EL with Data2.

A continuing problem seems to still exist when the functions "Xaverage" or
"Average"  use a calculated variable, rather than a simple input like
"Close" for data2.

Facts:
1- data1 is the QQQ for 1 minute
2- data2 is the NQZ01.D for 5 minutes

Reprinted below is the following:
1- EL code for a showme.  It places a dot on the low if a stochastic is
rising.  Included is the commentary used to debug.
2- EL code for an indicator.  It is plotted based on data2 and places a
green dot if the 5 min stoch is rising and a red dot if the 5 min
         stochastic is falling.  It also shows the commentary used to debug.
3- a print out of the commentary for 11/19/01 at 15:04 pm.


You can see the following:
1- ShowMe and indicator values agree up to #7 -- calculation of FstK.
Thereafter the values differ.
2- Changing the function from "Xaverage" to "Average"  did not solve the
problem.

 Perhaps you or someone else on the list can solve the problem.

Thanks.

Barry Silberman
===================================================================

{EL code for ShowMe}

inputs:
            lenStoch_data2(13),
            len2Stoch_data2(3);

variable:
            StochCritLg_Trend2(false),
            FstK(0),
            SloK(0);

Condition1 = Close > Open ;


Value51 = Lowest(Low data2, lenStoch_data2);
Value52 = Highest(High data2, lenStoch_data2) - Value51;
Value53 = Close data2;

If Value52 > 0 Then
            FstK = (Value53 - Value51) / Value52 * 100
Else
            FstK = 0;

SloK = XAverage(FstK,len2Stoch_data2);


If SloK  > SloK[1] then
            StochCritLg_Trend2 = true
else StochCritLg_Trend2 = false ;

if  Condition1 and  StochCritLg_Trend2 then
            Plot1(low,"Lentry");


             Commentary("", newline, newline ,
            "1- Value51=", Value51, newline,
            "2- lenStoch_data2=", lenStoch_data2, newline,
            "3- len2Stoch_data2=", len2Stoch_data2, newline,
            "4- Value52=", Value52, newline,
            "5- Value53=", Value53, newline,
            "6- FstK=", FstK, newline,
            "7- SloK=", SloK, newline,
            "8- SloK[1]=", SloK[1], newline,
            "9- XAverage(FstK,len2Stoch_data2)=",
XAverage(FstK,len2Stoch_data2), newline,
            "9A- Average(FstK,len2Stoch_data2)=",
Average(FstK,len2Stoch_data2), newline,
            "10- slok > slok[1]=", slok > slok[1], newline,
            "11- StochCritLg_Trend2=", StochCritLg_Trend2);


===================================================================
{EL code for indicator}
{stochastics per Perry Kaufman in "Trading Systems & Methods" pg 136}

Inputs: length(13), length1(3);
Variable: FstK(0), SloK(0), SloD(0);

Value51 = Lowest(Low, Length);
Value52 = Highest(High, Length) - Value51;
Value53 = Close;

If Value52 > 0 Then
            FstK = (Value53 - Value51) / Value52 * 100
Else
            FstK = 0;

SloK = XAverage(FstK,length1);


If slok > slok[1] then
            Plot1(0,"uptrend", green, default, 4);

If slok < slok[1] then
            Plot2(0,"downtrend", red, default, 4);


Commentary("", newline, newline ,
            "1- Value51=", Value51, newline,
            "2- Length=", Length, newline,
            "3- length1=", length1, newline,
            "4- Value52=", Value52, newline,
            "5- Value53=", Value53, newline,
            "6- FstK=", FstK, newline,
            "7- FstK[1]=", FstK[1], newline,
            "8- FstK[2]=", FstK[2], newline,
            "9- (FstK + FstK[1] + FstK[2])/3=", (FstK + FstK[1] +
FstK[2])/3, newline,
            "10- SloK=", SloK, newline,
            "11- SloK[1]=", SloK[1], newline,
            "12- XAverage(FstK,length1)=", XAverage(FstK,length1), newline,
            "12A- Average(FstK,length1)=", Average(FstK,length1), newline,
            "13- slok > slok[1]=", slok > slok[1]);
=====================================================


Analysis Commentary for TradeStationQQQ 1 min [AMEX] Nasdaq 100
      Trust-11/19/2001 15:04

_test 10A (ShowMe):
1- Value51= 39.53
2- lenStoch_data2= 13.00
3- len2Stoch_data2= 3.00
4- Value52= 0.35
5- Value53= 39.80
6- FstK= 77.14
7- FstK[1]= 77.14
8- FstK[2]= 77.14
9- (FstK + FstK[1] + FstK[2])/3= 77.14
10- SloK= 77.17
11- SloK[1]= 77.20
12- XAverage(FstK,len2Stoch_data2)= 77.17
12A- Average(FstK,len2Stoch_data2)= 77.14
13- slok > slok[1]= FALSE
14- StochCritLg_Trend2= FALSE


_Stochastic -Inc/Dec (Indicator):
1- Value51= 39.53
2- Length= 13.00
3- length1= 3.00
4- Value52= 0.35
5- Value53= 39.80
6- FstK= 77.14
7- FstK[1]= 78.38
8- FstK[2]= 70.27
9- (FstK + FstK[1] + FstK[2])/3= 75.26
10- SloK= 73.25
11- SloK[1]= 69.35
12- XAverage(FstK,length1)= 73.25
12A- Average(FstK,length1)= 75.26
13- slok > slok[1]= TRUE


----- Original Message -----
From: "Wayne Mathews" <wayne@xxxxxxxxx>
To: "Barry Silberman" <barry@xxxxxxxxxxxxxxxxxxxxx>
Cc: "=omega list" <omega-list@xxxxxxxxxx>
Sent: Friday, November 23, 2001 5:09 PM
Subject: Re: need help with EL and data2


> Barry-
>
> The ShowMe gave the correct average for the 5 minute bars of data2 in
> your second post not just due to referencing the function,
> AverageFC(Price2,MALength) outside by data2 (instead of inside, see
> below) but also that Price2 was changed from being declared a local
> variable to declared as an input.
>
> Addressing data2 in subgraph2 using a function in subgraph1 (loaded with
> data1) is more complex than it first appears. The following combinations
> are separated into those that give a correct average for data2 when the
> indicator is loaded into the data1 stream from those that do not.
>
> AverageFC is a series function whereas Average is a simple function. If
> the function "Average" is substituted for "AverageFC" , some of the
> second (non-workable) set move to the first set. This is due to a simple
> function being able to use a local variable from the study (indicator)
> as an input into the function which is imbedded in that study. An
> ASTERISK marks the combination in the second set that give the correct
> average for 5 minute bars of data2 if the function "Average" is
> substituted for "AverageFC". Of course, if "Average" is substituted for
> "AverageFC" in the first set, all of them give the correct results.
>
> A study addressing 5 minute bars of data2, when loaded into 1 minute
> data1 (subgrpah1) will give a value every minute bar unless prohibited
> in the code. The DOUBLED ASTERISK combination gives accurate values at
> the 5 minute bars of data2 but not at the minute bars in between!
>
> FOLLOWING GIVE THE CORRECT AVERAGE OF DATA2 (Subgraph2) WHEN A "SHOWME"
> IS LOADED INTO DATA1 (Subgraph1).
>
> Input: price(c);
> Var: MA(0);
> MA=AverageFC(price,len) data2;
>
>   {AverageFC(price data2, len) will not verify}
> -----------------------------------
>
> Var: MA(0);
> MA=AverageFC(c data2,len);
> -----------------------------------
>
> Var: MA(0);
> MA=AverageFC(c, len) data2;
>
>
>
> DO NOT GIVE THE CORRECT AVERAGE OF DATA2 (Subgraph2) WHEN LOADED INTO
> DATA1 (Subgraph1).
>
> {*}
> Input: price(c data2);
> Var: MA(0);
> MA=AverageFC(price, len);
>
>    {It is surprising this does not give correct results. It looks like
> the second example above. If Average is substituted for AverageFC it
> does work.}
> ---------------------------------------
>
> {**}
> Var: price(0, data2), MA(0);
> Price=Close;
> MA=AverageFC(price, len);
>
>   {When substituting "Average" the 5 minute bars are accurate and the 1
> minute bars are only slightly off. Since the 1 minute bars are not of
> interest in Barry's signal this slight inaccuracy does not matter.}
> ---------------------------------------
>
> Var: price(0), MA(0);
> Price=close data2;
> MA=AverageFC(price, len);
>
>    {This case is not expected to work because a variable can not be used
> as an input to a series function. However, it is expected to work upon
> substituting the simple function, "Average", where a variable can be
> used as an input. BUT IT DOES NOT!? THIS WOULD IMPLY THAT A VARIABLE CAN
> NOT BE USED AS AN INPUT IN A SIMPLE FUNCTION THAT IS TRYING TO ADDRESS A
> DATA STREAM OTHER THAN THE ONE IT IS LOADED INTO. For me this was an
> unexpected result.
>
> Even more unexpected is that the above combination gives the correct 5
> minute averages when loaded into DATA2 (subgraph2) ( what happened to
> series functions not being able to use variables as inputs?). But , as
> expected, if loaded into data1 and referencing data1 the 1 minute, the
> results are incorrect (slightly).}