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

Re: Time Based Moving Average



PureBytes Links

Trading Reference Links

>Subject:         Time Based Moving Average  
>Date:         Tue, 18 May 1999 02:00:12 -0500
>  From:        "knyyt" <knyyt@xxxxxxxxxxxx>
>    To:        "C_List" <code-list@xxxxxxxxxxxxx>, <omega-list@xxxxxxxxxx>
>
>Would anyone know how to code this into a indicator? Another question, is
>there a way we could have " minutes " as a unit of time as a
>  input?        And Bob, thanks for your patience in helping with my limited
>EL skills.
>
>Bill
>
>
>Value1 = TimeToMinutes(Time);
>
>if Mod(Value1, 10) = 0 then begin
>
>   {Calculations every 10 minutes}
>
>end;


Here's an exponential average that is time-related.  However, it needs
minute bars, not ticks.  


{  Calculates a Daily XMA on Intraday Data with a calculated length
   equivalent to an N-day MA.  Adjusted by the BarInterval - must
   be in minutes, not ticks.   DayLeng =1 is essentially an 8-hour XMA. 
   DayLeng may also be fractional days: .13 = 1 hour }


inputs: DayLeng(5) ;
vars: Factor(2/ (DayLeng * (390 / BarInterval) + 1)), Price(0),
MyXavg(0) ; 

IF BarNumber = 1  Then  MyXavg = C 
	Else MyXavg =   Factor * C  +  (1 - Factor ) * MyXavg[1]  ;

Plot1 (MyXavg ,"Xavg") ;