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

Re: [Metastockusers] Daily moving average on hourly charts



PureBytes Links

Trading Reference Links

Hi Tim

I wouldn't say that my approach is more professional but I have taken some effort to make my daily
indicators for intraday charts as accurate and flexible as possible. My SMA method is not ideal but
it's the best method in terms of flexibility that I've come up with so far.

My weekly indicators for daily charts and daily indicators for intraday charts can all be found at
http://users.bigpond.com/prominex/pegasus.htm#roy
For the greatest possible timing accuracy these all use Jose's "Calendar Week counter" or "Calendar
Day counter" which enable the detection of odd gaps in data.

Here are some adaptations of that method that don't use the Calender day counter. These also plot on
daily charts and appear to be 100% accurate on the chart I'm testing with. The first one is using
the same summing method as you, and the second is using a total of all days minus the total "x" days
ago as the summing method.

Hope this is what you are looking for.

For my part I'm going to take another look at your summing method and see if it isn't a better
solution for a simple moving average.

Regards

Roy

  {Daily SMA - Close}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
N:=Input("Daily SMA Close",8,8,8);
A:=Input("Hour of Last Daily Bar"  ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode,  0=Static  1=Dynamic  2=Test",0,2,2);
  {0=Display, update at last bar of day}
  {1=Display, update on each new bar}
  {2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
   ValueWhen(2,1,DayOfWeek()),5))=5);
I:=DayOfMonth()<>ValueWhen(2,1,DayOfMonth());
M:=G OR I;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+Q=2,1,(B=0)*J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
X:=ValueWhen(1,J,K)+
ValueWhen(2,J,K)+
ValueWhen(3,J,K)+
ValueWhen(4,J,K)+
ValueWhen(5,J,K)+
ValueWhen(6,J,K)+
ValueWhen(7,J,K)+
ValueWhen(8,J,K); X/8;

  {Daily SMA - Close}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
N:=Input("Daily SMA - Close Periods",1,99,10);
A:=Input("Hour of Last Daily Bar"  ,0,23,16);
B:=Input("Minute of Last Daily Bar",0,59,00);
Q:=Input("Display Mode,  0=Static  1=Dynamic  2=Test",0,2,2);
  {0=Display, update at last bar of day}
  {1=Display, update on each new bar}
  {2=Backtest, update on first bar of new day}
G:=LastValue(Highest(Sum(DayOfWeek()<>
   ValueWhen(2,1,DayOfWeek()),5))=5);
I:=DayOfMonth()<>ValueWhen(2,1,DayOfMonth());
M:=G OR I;
F:=G OR (Hour()=A AND Minute()=B);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
J:=If(F,1,If(Alert(F,2)=0 AND M,2,0));
J:=If(A+LastValue(J)>2 OR B+Q=2,1,(B=0)*J);
J:=If(G,1,If(Q=2 OR Cum(J)<=1,M*2,J));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;


----- Original Message ----- 
From: "timinwaedi" <timinwaedi@xxxxxxxxxxx>
To: <Metastockusers@xxxxxxxxxxxxxxx>
Sent: Wednesday, March 24, 2004 2:05 AM
Subject: [Metastockusers] Daily moving average on hourly charts


> The following code is an attempt to superimpose daily moving averages
> on hourly charts. Has anyone got a more professional solution to this
> type of indicator?
> ========================================
>
> Hr:=If(Hour()<Ref(Hour(),-1),1,0);
> Dc1:=ValueWhen(1,Hr,C);
> Dc2:=ValueWhen(2,Hr,C);
> Dc3:=ValueWhen(3,Hr,C);
> Dc4:=ValueWhen(4,Hr,C);
> Dc5:=ValueWhen(5,Hr,C);
> Dc6:=ValueWhen(6,Hr,C);
> Dc7:=ValueWhen(7,Hr,C);
> Dc8:=ValueWhen(8,Hr,C);
> Mov8:=(Dc1+Dc2+Dc3+Dc4+Dc5+Dc6+Dc7+Dc8)/8;
> Mov8
>
> =========================================
>
>
> Thanks,
>
> Tim
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/Metastockusers/

<*> To unsubscribe from this group, send an email to:
     Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/