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

Re: need help with EL and data2



PureBytes Links

Trading Reference Links

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).}
-------------------------------------
///////////////////////////////////////////////////


> 
> Subject:           need help with EL and data2
>     Date:           Fri, 16 Nov 2001 12:14:39 -0500
>    From:           "Barry Silberman" <barry@xxxxxxxxxxxxxxxxxxxxx>
> 
>      Could someone  please help me see why the values for the moving average
> for data2 in the ShowMe are different than the values on the indicator
> plotted in data2.
> 
> Facts:
> 1- data1 is 1 minute QQQ
> 2- data2 is 5 minute QQQ
> 3- When I insert Showme on data1, the tab called "data" is set to
>              "Base Study on"  data1, and   "Subgraph" selected is one.
> 
> 4- the indicator is plotted on data2
>      (A) the tab called "data" is set to
>                "Base Study on"  data2, and   "Subgraph" selected is two
>      (B)  the inputs are definitely the same as called for in the ShowMe.
> 
> 
> Example of problem:
> 1-  on 12:15 EST on 11/15/01 the MA on the indicator is 39.56 and the MA on
> the ShowMe is 39.52
> 
> The code is as follows:
> 
> inputs: timepd1( 0930 ),  timepd2( 1130 ),timepd3( 1330 ),
>             timepd4( 1600 ), MALength( 20 ) ;
> 
> variable:   BuySig( 0 ),   SellSig( 0 ),   OK2Trade( false ),
>             MA2( 0 ),    Price2( 0 ) ;
> 
> Price2 = Close data2 ;
> MA2 = AverageFC( Price2, MALength );
> 
> if time  >= timepd1 and time  <= timepd4 then
>             OK2trade = true
> else OK2trade = false ;
> 
>   {Calculate Data1}
> Condition1 = Close > Open ;
> Condition2 = Price2 > MA2;
> if OK2trade and Condition1 and condition2 then
>             Plot1(High,"NRBar");
> 
> Print( Date, Time, "  ", "MA2", MA2 ) ;
> 
> 
> Subject:           Solution to help with EL and data2
>     Date:           Sat, 17 Nov 2001 09:42:28 -0500
>    From:           "Barry Silberman" <barry@xxxxxxxxxxxxxxxxxxxxx>
> 
> For those who might need to code a situtation where data2 is a different
> time frame than data1, the solution to the problem was to modify MA2 so that
> "data2" was placed outside the parenthesis.
> 
> I found the answer in an old Omega System Trading and Development Club
> volume example.
> 
> Barry
> 
> ===========================================
> inputs:   timepd1( 0930 ),   timepd2( 1130 ),  timepd3( 1330 ), timepd4( 1600 ),
>             MALength( 20 ) ,
>             Price2(close);
> 
> variable:       BuySig( 0 ),       SellSig( 0 ),       OK2Trade( false ),   MA2( 0 ) ;
> 
> MA2 = AverageFC( price2, MALength ) data2;
> 
> \\I deleted the code here as it is the same as above\\
> 
> Print( Date, Time, "  ", "MA2", MA2 ) ;