PureBytes Links
Trading Reference Links
|
HAhaHAha!!!!!
Hihihihihi...
Gnâaaaaaaar...ffff!
This time you got the proof that Easy Language is REALLY easy language.
=====================================================================
inputs : Price(NumericSeries),Length(NumericSimple);
vars : Factor(0),xavg0(0);
if Length + 1 <> 0
then begin
if CurrentBar <= 1
then begin
XAvg0 = Price;
end
else
Factor = 2 / (Length + 1);
XAvg0= Factor * Price + (1 - Factor) * XAvg0;
end;
xavg=xavg0;
=====================================================================
Compare with Xaverage code from the Power Editor even by modifying one line
for initialisation!
inputs : Price(NumericSeries),Length(NumericSimple);
vars : Factor(0),xavg0(0);
if Length + 1 <> 0
then begin
if CurrentBar <= 1
then begin
XAvg0 = average(Price, length); <==== (I can replace by a loop if you
want, 3 lines)
end
else
Factor = 2 / (Length + 1);
XAvg0= Factor * Price + (1 - Factor) * XAvg0;
end;
xavg=xavg0;
=====================================================================
Maybe only a C version of the Xaverage code could be more complicated than
the ESPL version of the Xaverage code below.
Thanks a lot Earl, I think that none will try to download Ensign software
now!
Unfortunately, this will not stop yet your multiple message post to promote
this dinosaur tool on Omega List.
HAhaHAha!!!!! Hihihihihi...
-Pierre Orphelin
Représentant exclusif de Omega Research en France.
web: http://www.sirtrade.com
=====================================================================
-----Message d'origine-----
De : Earl Adamy <eadamy@xxxxxxxxxx>
>
>Function ufAverageExponential(lLastBar : LongInt; lLength : LongInt;
>lValueConstant : LongInt; rPrevXA : Real) : Real;
>/**************************************************************************
*
>***
> Author : Earl Adamy
> Copyright: Copyright 1999 by Earl Adamy, all rights reserved <<===== OH
YES, keep it !!!!
> History : 01/26/99 Create function
> Purpose : Calc Exponential MA of specifed bar value in current chart
> lLastBar is last bar on which Average is to be calculated
> 0 specifies that BarEnd is to be used
> lLength is number of bars over which Avg is to be calculated
> lValueConstant is one of following:
> eOpen, eHigh, eLow, eClose, eLast (Close) values on bar
> eRange (High - Low)
> eTrueRange (> High or yesterday Low - < Low or yesterday
>High
> eMidpoint (H+L/2), eMid3 (H+L+C/3, eMid4 (O+H+L+C/4)
> eNet (Close - Yesterday Close)
> rPrevXA is for recursing the previous XA providing more
>efficient calcs
> Formula : XFactorToday = 2 / (lLength + 1)
> XMA = (Price(today) * XFactorToday) + XMA(yesterday) * (1 -
>XFactorToday)
>
>***************************************************************************
*
>**/
>var
> lBarX: LongInt;
> lBarBeg: LongInt;
> lBarEnd: LongInt;
> rAverage: Real;
> rXFactorToday: Real;
>
>Begin
> If lLastBar = 0 Then
> {default to EndBar}
> lBarEnd := BarEnd
> Else
> {use requested bar}
> lBarEnd := lLastBar;
> rXFactorToday := (2.0 / (lLength + 1));
>
> rAverage := rPrevXA;
> If rAverage = 0.0 then Begin
> /* Initializes calc with simple average for bar (lLastBar - Length),
> then runs exponential calculation for length bars to bring
> exponential average up to speed
> */
> lBarBeg := (lBarEnd - lLength);
> if lBarBeg < 1 then lBarBeg := 1;
> rAverage := Average(lValueConstant, lBarBeg, lLength);
> lBarBeg := lBarBeg + 1;
> End
> Else
> {Calculate average for one period}
> lBarBeg := lBarEnd;
> For lBarX := lBarBeg to lBarEnd do
> rAverage := (rXFactorToday * Bar(lValueConstant, lBarX)) + ((1.0 -
>rXFactorToday) * rAverage);
> Result := rAverage;
>End; {ufAverageExponential}
>
|