PureBytes Links
Trading Reference Links
|
In TraderWare this is how a simple moving average is plotted as an
indicator. While it looks more complicated that in easy language "it is
not". One reason is that if you wanted a simple moving average you don't
have to type all the stuff you see below. You can just copy and paste from
our library of pre built's and there you have it. Or just like some other
popular programs you can bring up a chart and pick moving average from a
list and click on it and it pops onto the chart. Note : We use a common
everyday language VB, we have set the standard that all other market related
software packages must come to or die. We have freed the end user from
dependency on third party vultures to write their studies. The clients can
go take a course on VB at any community college.
mb
========================
Sub IndicatorEntry()
'Calculate a 5 period simple moving average of the closing price
Call TW.CalcFormula("MOV(c,5,s)", twDate, twHigh, twLow, twOpen, twClose,
twOpenInterest, twVolume, twResults, twDates, twValid)
'Plot the result
Call TW.PlotIndicator(twPanelID, twName, twStyle, twDates, twResults,
twValid, twColor)
End Sub
=========================
----- Original Message -----
From: pierre.orphelin <pierre.orphelin@xxxxxxxxxx>
To: L_Omega <omega-list@xxxxxxxxxx>
Sent: Tuesday, April 27, 1999 6:51 PM
Subject: Re: Best alternative to TradeStation 2000i?
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}
>
|