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

Unidentified subject!



PureBytes Links

Trading Reference Links

Recalling that trouble was recently spotted when using a variable at the
location of the data set in generating spreads, I prepared a little test
using the bonds in data1 and the sp500 in data2.  There are 11 tests.  All
of them should not plot anything since what we are comparing is
theoretically equal.  However, sometimes we do get a plot.  Sometimes the
difference is significant.  The upshot is that you need to be careful with
this form of code.  If you use the form Data(X), it should be placed outside
any functions rather than within.  For instance, use Average(c,2) data(x)
rather than Average(C Data(x),2).  Even so, this generates a small error
which is not good, but might be acceptable in some cases.  The code for the
test is the indicator below.


{-------------------------Code Starts Here-------------------------}
{Indicator: ~Test Data2}

Inputs: Test(1), x(2);

{Test1 - This works fine}
If Test = 1 then begin
value1 = C data1 - C data(x);
value2 = c data1 - c data2;
if value1<>value2 then plot1( value1- value2,"~~test");
end;

{---------------------------------------------------------------------------
------------}
{Test2 - Large Errors}

If Test = 2 then begin
value1 = Average(C data1,2) - average(C data(x),2);
value2 = Average(C data1,2) - Average(C data2,2);
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test3 Small Errors}

If Test = 3 then begin
value1 = Average(C data1,2) - average(C ,2) data(x);
value2 = Average(C data1,2) - Average(C,2)  data2;
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test4 - Small errors}

If Test = 4 then begin
value1 = Average(C,2)   - average(C data(x) ,2) data(x);
value2 = Average(C,2)   - Average(C  data2 ,2) data2;
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test5 - This works fine}

If Test = 5 then begin
value1 = Average(C,2)   - average(C ,2) data(2);
value2 = Average(C,2)   - Average(C ,2) data2;
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test6- large errors}

If Test = 6 then begin
value1 = Average(C Data2,2);
value2 = Average(C Data(x) ,2);
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test7 small errors}

If Test = 7 then begin
value1 = Average(C,2)  Data2;
value2 = Average(C ,2)  Data(x);
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test8  This works fine}

If Test = 8 then begin
value1 = Average(C,2)  Data2;
value2 = Average(C Data2 ,2) ;
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test9 This works fine}

If Test = 9 then begin
value1 = C data2 - C[1] data(x);
value2 = c data2 - c[1] data2;
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test10 This works fine}

If Test = 10 then begin
value1 = C data(x) - C[1] data(x);
value2 = c data2 - c[1] data2;
if value1<>value2 then plot1( value1- value2,"~~test");
end;
{---------------------------------------------------------------------------
------------}
{Test11 This works fine}

If Test = 10 then begin
value1 = C[1] data2 - C[1] data(x);
if value1<>0 then plot1( value1,"~~test");
end;
{------------------------Code ends here--------------------------}



Best Regards,
William Brower
Inside Edge Systems
10 Fresenius Rd. 
Westport, Ct 06880
Publisher of TS Express 
The Journal for Informed Users of TradeStation
Free Sample Available (Send Mail Address)

Internet: 1000mileman@xxxxxxxxxxxxxx
Tel: 203-454-2754 
Fax: 203-221-9195