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

Re: Sine-Weighted Moving Average



PureBytes Links

Trading Reference Links

<x-html><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3616.1301"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000000 size=2>VonHef</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>You wonder why Cheryl Elton did not refer to PI. 
I wonder why Cheryl didn't refer to SD in the calculations of S1 through S5 (as 
she did in the DEN calculation) rather than the original fraction. The whole 
point of defining SD was so that she never had to make that calculation again, 
which she proceeds to do 5 more times. Just goes to show there are myriad ways 
to write a mathematically identical indicator.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>For the sake of efficiency I would think she would want to 
avoid unnecesssary calls to the SINE function and recalculation of the SD value. 
And unless I wanted to explore this calculation using different angles that I 
could change by virtue of a single change in the code, I would just refer to 
SIN(30) and SIN(60) etc without even creating SD. However, I should think that 
the code below would execute more efficiently.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>PI:=3.1415926; {seems unnecessary}<BR>SD:=180/6; 
{defined once to reduce a chance of mistake and for easier alternative 
calculations}<BR>S1:=Sin(1*SD);<BR>S2:=Sin(2*SD);<BR>S3:=Sin(3*SD);<BR>S4:=Sin(4*SD);<BR>S5:=Sin(5*SD);<BR>Num:=S1*C+S2*Ref(C,-1)+S3*Ref(C,-2)+S4*Ref(C,-3)+S5*Ref(C,-4);<BR>Den:=S1+S2+S3+S4+S5;<BR>Num/Den</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I don't have that copy of the TASC, so I can't 
evaluate the accuracy of Cheryl's code. Presumably there is no different 
mathematical result of her and my code.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Who knows, I very easily might learn something from your 
question.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Joe</FONT></DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">
    <DIV><FONT face=Arial size=2><B>-----Original Message-----</B><BR><B>From: 
    </B>VonHef &lt;<A 
    href="mailto:VonHef@xxxxxxxxxxxxx";>VonHef@xxxxxxxxxxxxx</A>&gt;<BR><B>To: 
    </B>MetaStock &lt;<A 
    href="mailto:metastock@xxxxxxxxxxxxx";>metastock@xxxxxxxxxxxxx</A>&gt;<BR><B>Date: 
    </B>Saturday, May 15, 1999 07:52 PM<BR><B>Subject: </B>Sine-Weighted Moving 
    Average<BR><BR></DIV></FONT>In the June 99 issue of TASC there is an article 
    written<BR>by Patrick E. Lafferty named:<BR>&quot;How Smooth Is Your Data 
    Smoother?&quot;. This article<BR>compares different types of moving averages 
    and he<BR>describes one he calls a &quot;Sine-Weighted Moving 
    Average&quot;.<BR>Below I have posted the code that was provided for 
    MetaStock,<BR>but I have few questions about it........why did they define 
    the<BR>variable named &quot;PI&quot;? I know what PI is, but the code never 
    &quot;calls&quot;<BR>this variable. Also I wonder why there is no option to 
    choose<BR>the look-back period.....this code is only a 5 day 
    average.<BR>Anywise here is the code:<BR><BR>{Sine-Weighted Moving 
    Average<BR>&nbsp; by Cheryl Elton,Equis 
    International}<BR>PI:=3.1415926;<BR>SD:=180/6;<BR>S1:=Sin(1*180/6)*C;<BR>S2:=Sin(2*180/6)*Ref(C,-1);<BR>S3:=Sin(3*180/6)*Ref(C,-2);<BR>S4:=Sin(4*180/6)*Ref(C,-3);<BR>S5:=Sin(5*180/6)*Ref(C,-4);<BR>Num:=S1+S2+S3+S4+S5;<BR>Den:=Sin(SD)+Sin(2*SD)+Sin(3*SD)+Sin(4*SD)+Sin(5*SD);<BR>Num/Den<BR><BR>&nbsp; 
    Best wishes,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Adam Hefner.<BR><A 
    href="mailto:VonHef@xxxxxxxxxxxxx";>VonHef@xxxxxxxxxxxxx</A><BR><BR>---------------------------------------<BR><BR><BR><BR></BLOCKQUOTE></BODY></HTML>
</x-html>From ???@??? Sun May 16 20:18:34 1999
Received: from listserv.equis.com (204.246.137.2)
	by mail02.rapidsite.net (RS ver 1.0.2) with SMTP id 7602;
	Sun, 16 May 1999 22:18:34 -0400 (EDT)
Received: (from majordom@xxxxxxxxx)
	by listserv.equis.com (8.8.7/8.8.7) id UAA09261
	for metastock-outgoing; Sun, 16 May 1999 20:10:07 -0600
X-Authentication-Warning: listserv.equis.com: majordom set sender to owner-metastock@xxxxxxxxxxxxx using -f
Received: from freeze.metastock.com (freeze.metastock.com [204.246.137.5])
	by listserv.equis.com (8.8.7/8.8.7) with ESMTP id UAA09257
	for <metastock@xxxxxxxxxxxxxxxxxx>; Sun, 16 May 1999 20:10:04 -0600
Received: from hme0.mailrouter02.sprint.ca (hme0.mailrouter02.sprint.ca [207.107.250.60])
	by freeze.metastock.com (8.8.5/8.8.5) with ESMTP id UAA12728
	for <metastock@xxxxxxxxxxxxx>; Sun, 16 May 1999 20:20:47 -0600 (MDT)
Received: from walter (spc-isp-mtl-58-4-4.sprint.ca [149.99.137.4])
	by hme0.mailrouter02.sprint.ca (8.8.8/8.8.8) with SMTP id WAA06312
	for <metastock@xxxxxxxxxxxxx>; Sun, 16 May 1999 22:08:47 -0400 (EDT)
Message-ID: <001d01bea00a$449b5420$04896395@xxxxxx>
From: "Walter Lake" <wlake@xxxxxxxxx>
To: "Metastock bulletin board" <metastock@xxxxxxxxxxxxx>
Subject: System tests
Date: Sun, 16 May 1999 22:09:15 -0400
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Sender: owner-metastock@xxxxxxxxxxxxx
Precedence: bulk
Reply-To: metastock@xxxxxxxxxxxxx
X-Loop-Detect: 1
X-UIDL: efd5c94932423666f942f44cc10103d8.1f

Thanks for the email.

No ... the 2 moving average system is not the only trading system that
Sweeney used in "Campaign Trading".

He examined 4 trend systems and 2 range systems on 10 years of continuous
crude oil data.

The main trend system was the 2 moving average system, with 3,600 points of
profit.

The second and third trend systems were add-on day-trades and add-on
position trades. With 2,500 and 640 points of profit.

The fourth trend system was a reversal system with 1,827 points of profit.

The range systems were trade into range and reverse out of range with 550
and 2,229 points of profit.

So, the six systems can keep you quite busy.


Best regards

Walter