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

Re: article "triggering your trading signal"



PureBytes Links

Trading Reference Links

The code posted by Robert was incorrect.    I have inserted corrected code
below.

I coudn't post this to the Code List as my name was rejected (even though
I'm on
Code List.)

----- Original Message -----
From: <rickinri@xxxxxxx>
To: <code-list@xxxxxxxxxxxxx>; <omega-list@xxxxxxxxxx>
Sent: Saturday, October 23, 1999 3:28 PM
Subject: article "triggering your trading signal"


> Saw a interesting article on article "triggering your trading signal"
> by B Cotton on TSC web site found it hard to understand .Author
> said that EL code and a better explanation was on page 90 of the
> November issue, dont subscribe any more and cant seem to find a
> place on the web site to purchase the current issue, has any one
> seen the code and could post it on the list?
> I have 20 or 30 old copies of TSC that are anyones for the asking
> late 80's and early 90's
> Rick
>

{Plots Price where two Moving Averages are equal

Inputs:
LengthS = Length of Short Average
Length of Long Average is set by MaxBarsBack
i.e. MaxBarsBack set to 30 means the Length of the Long Average = 30

This code plots the two moving averages (Plot1 and Plot2) and the price
that would cause the averages to be equal (Plot3), if it's within
10 points of the current High or Low.

To verfiy the results you can plot the difference between the two moving
averages and the
difference between a moving average and the equalization point.   To do this
comment out the plot statements and use the code that is commented out at
the end.
The difference between the M.A. Equalization point and the long moving
average will
almost equal 0 when the difference between the moving averages also equals
0,
confirming the code below works correctly.

Calculations are of course approximations because ELA variables are limited
to
6 significant digits.   However the results are reasonably close.

Input: Price(C), LengthS(10), LengthL(MaxBarsBack);

if CurrentBar = 1 then begin
 value11 = LengthS - 1;
 value12 = lengthL - 1;
 value15 = LengthL - LengthS;
End;

value1 = 0; {Sum 1 to LengthS-1}
value2 = 0; {sum 1 to LengthL-1}
value3 = 0; {Sum for Avgerage Short}
value4 = 0; {Sum for Average Long}
For value0 = 0 to value12 begin
 value5 = Price[value0];
 if value0 <= value11 then value3 = value3 + value5;
 value4 = value4 + value5;
End;

For value0 = 1 to value12 begin
 value5 = Price[value0];
 if value0 <= value11 then value1 = value1 + value5;
 value2 = value2 + value5;
End;

value5 = value3/LengthS; {average short}
value6 = value4/LengthL; {average long}
value7 = Round(LengthS*value2/value15 - LengthL*value1/value15, 2); {Price
that would converg}
Plot1(value5, "Short Avg");
Plot2(value6, "Long Avg");
if value7 > L - 10 and value7 < H+10 then Plot3(value7, "Converg");


{Code to plot moving average and equalization point differences.
value8 = value7 - value6;
Plot1(value5-value6, "Diff");
if value8 < 10 and value8 > -10 then begin
 Plot2(value8, "Converg");
 if (value8 < 0 and value8[1] > 0) or (value8 > 0 and value8[1] < 0) then
  value0 = TL_New(Date[1], Time[1], value8[1], Date, Time, Value8);
End;
Plot3(0, "One");}