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

[EquisMetaStock Group] Re: Trend Strength Indicator



PureBytes Links

Trading Reference Links

Now, if you want to build a model using this indicator, you don't want
to calculate all those moving averages, as it will make any
optimisation process very slow.  MSFL is slow by default, so you want
to speed up things anyhow, even if you are not optimising.  So you
calculate just one indicator, the cumulative sum of the closes, and
use only that.

You also want to test how many of these steps you should perform. 
Should you use 5, 10, 15 or whatever.  Also, you rebase the indicator
to somewhere between -1 and +1, so that it remains the same for all
combinations.  You also rewrite it a bit so that divisions, which take
longer to do, become multiplications, and the new 'thing' becomes

----8<------------------

{Trend Strength Indicator}
{for metastock, coded by P Umrysh}
{from the August 2005 issue of Active Trader Magazine}
{modified by wabbit 08Jul05}
{modified by MG Ferreira 09 Jul 05}

PRD   := INPUT("Enter periods",1,100,10);
STEP  := INPUT("Enter step size",1,50,10);
NSTEP := INPUT("Enter number of steps",1,20,10);

XX    := Cum(C);

SS    :=
(C*PRD           > (XX-Ref(XX,-PRD        )))              +
(C*(PRD+   STEP) > (XX-Ref(XX,-PRD-   STEP))) * (NSTEP> 1) +
(C*(PRD+ 2*STEP) > (XX-Ref(XX,-PRD- 2*STEP))) * (NSTEP> 2) +
(C*(PRD+ 3*STEP) > (XX-Ref(XX,-PRD- 3*STEP))) * (NSTEP> 3) +
(C*(PRD+ 4*STEP) > (XX-Ref(XX,-PRD- 4*STEP))) * (NSTEP> 4) +
(C*(PRD+ 5*STEP) > (XX-Ref(XX,-PRD- 5*STEP))) * (NSTEP> 5) +
(C*(PRD+ 6*STEP) > (XX-Ref(XX,-PRD- 6*STEP))) * (NSTEP> 6) +
(C*(PRD+ 7*STEP) > (XX-Ref(XX,-PRD- 7*STEP))) * (NSTEP> 7) +
(C*(PRD+ 8*STEP) > (XX-Ref(XX,-PRD- 8*STEP))) * (NSTEP> 8) +
(C*(PRD+ 9*STEP) > (XX-Ref(XX,-PRD- 9*STEP))) * (NSTEP> 9) +
(C*(PRD+10*STEP) > (XX-Ref(XX,-PRD-10*STEP))) * (NSTEP>10) +
(C*(PRD+11*STEP) > (XX-Ref(XX,-PRD-11*STEP))) * (NSTEP>11) +
(C*(PRD+12*STEP) > (XX-Ref(XX,-PRD-12*STEP))) * (NSTEP>12) +
(C*(PRD+13*STEP) > (XX-Ref(XX,-PRD-13*STEP))) * (NSTEP>13) +
(C*(PRD+14*STEP) > (XX-Ref(XX,-PRD-14*STEP))) * (NSTEP>14) +
(C*(PRD+15*STEP) > (XX-Ref(XX,-PRD-15*STEP))) * (NSTEP>15) +
(C*(PRD+16*STEP) > (XX-Ref(XX,-PRD-16*STEP))) * (NSTEP>16) +
(C*(PRD+17*STEP) > (XX-Ref(XX,-PRD-17*STEP))) * (NSTEP>17) +
(C*(PRD+18*STEP) > (XX-Ref(XX,-PRD-18*STEP))) * (NSTEP>18) +
(C*(PRD+19*STEP) > (XX-Ref(XX,-PRD-19*STEP))) * (NSTEP>19);

( 2*SS - NSTEP ) / NSTEP

----8<------------------


Now, this looks bad but is easily done using any programming language
where loops are allowed.  All those lines that form part of the sum SS
are done inside this loop as a fairly simple addition.  The loop ends
at the right spot, so that the multipliation with NSTEP > xx falls away.

I also am not sure about MSFL, but this function is supposed to be
very fast.  In a normal programming language, at each step, you just
update xx as XX = XX + C.  XX starts at 0.  MSFL does not allow this,
so the one difference between this function and the original is that
it starts one observation later than the original.  Again, in a real
programming language, this would not be the case.

Now, if only super can endorse the trading qualities of this new
indicator I can sell it to the world and retire early.....

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com 




--- In equismetastock@xxxxxxxxxxxxxxx, "bellamy_29m"
<bellamy_29m@xxxx> wrote:
> Similar results (0-10) instead of -100 to 100 with simpler code:
> 
> {Trend Strength Indicator}
> {for metastock, coded by P Umrysh}
> {from the August 2005 issue of Active Trader Magazine}
> {modified by wabbit 08Jul05}
> 
> PRD:= Input("ENTER PERIODS FOR SMA",1,100,10);
> STEP:= Input("ENTER SMA STEPS",1,50,10);
> 
> (C>Mov(C,PRD+(STEP*0),S))+
> (C>Mov(C,PRD+(STEP*1),S))+
> (C>Mov(C,PRD+(STEP*2),S))+
> (C>Mov(C,PRD+(STEP*3),S))+
> (C>Mov(C,PRD+(STEP*4),S))+
> (C>Mov(C,PRD+(STEP*5),S))+
> (C>Mov(C,PRD+(STEP*6),S))+
> (C>Mov(C,PRD+(STEP*7),S))+
> (C>Mov(C,PRD+(STEP*8),S))+
> (C>Mov(C,PRD+(STEP*9),S))
> 
> Hpe this helps.
> 
> wabbit :D
> 
> <snip>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

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

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