formule - metastock

Upload: alletuca

Post on 07-Apr-2018

2.224 views

Category:

Documents


195 download

TRANSCRIPT

  • 8/6/2019 Formule - Metastock

    1/554

    1

    Code Snippets

    &

    How Tos

    David Jennings

    The Performance Factory

  • 8/6/2019 Formule - Metastock

    2/554

    2

  • 8/6/2019 Formule - Metastock

    3/554

    3

    AIQ CODE..............................................................................................................................................9

    CANDLESTICKS ....................................................................................................................................9CANDLESTICK COLOUR STUDY ............................................................................................................9

    RATE OF

    CHANGE

    .................................................................................................................................9MONEY MANAGEMENT EXITS ............................................................................................................10MACDI EXIT RULES...........................................................................................................................10CONDITIONAL RULES-SELLING PRESSURE ...................................................................................11MOMENTUM .......................................................................................................................................12VIDYA - TUSHAR CHANDE ...............................................................................................................13SECTOR MOVEMENT...........................................................................................................................13PRICE/VOLUME CRITERIA?.................................................................................................................17HIGH JUMP CANDIDATE SELECTION ...................................................................................................17VOLUME SPIKE ...................................................................................................................................18VARIABLE PROFIT PROTECT STOP, LOSS STOP AND TIME STOP .........................................................19BUY FOR STOCKS IN A SECTOR...........................................................................................................20BOLLINGER BANDS ............................................................................................................................20

    LINEAR REGRESSION CALCULATION USING THE LEAST MEANS SQUARED METHOD ...........................21LINEAR REGRESSION METHOD BASED INDICATORS ............................................................................21SECTOR DIVERGENCE.........................................................................................................................22COUNTOF............................................................................................................................................23ATR AND WILDERS RSI ....................................................... ........................................................... .23RELATIVE STRENGTH .........................................................................................................................24RECURSION.........................................................................................................................................25

    METASTOCK CODE..........................................................................................................................28

    PRIMARY BUY SIGNAL .......................................................................................................................28PRIMARY SELL SIGNAL ......................................................................................................................28MARKETSPACE STOCK SYSTEM .........................................................................................................28

    Primary Buy Signal.......................................................................................................................28

    Primary Sell Signal.......................................................................................................................29SMOOTH STOCKS................................................................................................................................29Bressert Cycle Indicators..............................................................................................................30

    EXPLANATION OF THE MCCLELLAN OSCILLATOR..............................................................................31THRUST OSCILATOR:..........................................................................................................................31MIDAS VOLUME WEIGHTED AVE PRICE-SUPPORT/RESIST ...............................................................32STOCHASTIC CROSS TRADING SYSTEM ...................................................................... ...........33TSI AND ERGODICS INDICATORS..............................................................................................33

    Trading Ergodics with the Trend Rules ............................................................... ......................34RELATIVE STRENGTH OF STOCK TO INDEX ........................................................ ..................34FIND RSI ABOVE 80.......................................................................................................................36KASE DEV STOP .................................................................................................................................36WOLF WAVE PATTERNS..............................................................................................................36

    THE MARKET FACILITATION INDEX ...................................................................................................37TRUE STRENGTH INDEX..............................................................................................................38GANN SWING HILOW ACTIVATOR......................................................................................................41RUGGERIO'S TREND............................................................................................................................42AUTOMATIC METASTOCK TRENDLINE FORMULA...............................................................................42THE RECURSIVE MOVING TREND AVERAGE.......................................................................................44THREE INSIDE DAYS .......................................................... .......................................................... 49NR4 FORMULA...................................................................................................................................50MOVAVG ASYMMETRIC VOLATILITY PRICE BANDS ..........................................................................58REGRESSION ASYMMETRIC VOLATILE PRICE BAND ...........................................................................58WRO AND WSO INDICATORS..........................................................................................................152BODY MOMENTUM.....................................................................................................................158ST OSCILLATOR...........................................................................................................................159

    LOOKBACK ......................................................................................................................................160JACK LANDIS' WEIGHTED STOCHASTIC (SHORTENED TO LANDIS).....................................................163

  • 8/6/2019 Formule - Metastock

    4/554

    4

    CHANDE & KROLL'S R2 INDICATOR.................................................................................................165PRICE ACTION INDICATOR (PAIN)...................................................................................................165WEEKLY PIVOT POINT......................................................................................................................167HIGHEST HIGH SINCE BUY SIGNAL........................................................................................168FORECAST OSCILLATOR SYSTEM ALTERNATIVE..............................................................168FORECAST OSCILLATOR SYSTEM .............................................................. ............................ 168

    Chaos Blue BL ...................................................... ................................................................. .....171Chaos Red BL ............................................................ ............................................................ .....171Chaos Green BL..........................................................................................................................171Chaos Gator................................................................................................................................171

    CHAOS AO ................................................... ........................................................... ......................... 172Chaos AO Signal Line.................................................................................................................172Chaos AC........................................................ ............................................................... .............172Chaos Fractal ........................................................... ............................................................. .....172

    TRADING THE TREND 2 ............................................................. ................................................ 184TRADING THE TREND 1 ............................................................. ................................................ 186BOLLINGER BAND WIDTH........................................................... ............................................. 187BOLLINGER BAND HISTOGRAM KARNISH...........................................................................187BB HISTOGRAM ...............................................................................................................................191

    CHANDELIER EXIT, VERSION 2 METASTOCK CODE..............................................................196MOVING AVERAGE CROSSOVERS........................................................... ............................... 197VIDYA WITH P VARIABLE VERSION 2 ............................................................ .......................200VIDYA EXPLANATION......................................................... ...................................................... 201IMPROVED CHANDELIER EXIT................................................................................................217BOOMERS TRADING SIGNALS ............................................................................................................224

    Boomers buysig...........................................................................................................................224ADX AND TRENDLINES ............................................................. ................................................ 227ADX RISING EXPOLORATION...................................................................................................243SWING TRADING EXPERT ......................................................... ................................................ 243DMI EXPLORATION VERSION 3.........................................................................................................245VOLATILITY BREAKOUT...................................................................................................................249VOLATILITY EXPLORATION ..............................................................................................................253

    RELATIVE VOLATILITY INDEX..........................................................................................................254SMOOTHED ADAPATIVE STOCHASTIC OSCILLATOR ..........................................................................254SIDEWAYS CHANNELS EXPLORATION ..............................................................................................260STOCHASTIC AND RSI SYSTEM........................................................... .................................... 261DAHL OSCILLATOR...........................................................................................................................2632 DAY HAMMER EXPLORATION .......................................................................................................264WRO AND WSO INDICATORS..........................................................................................................265WRO INDICATOR:............................................................................................................................267GAP1 SYSTEM ..................................................................................................................................268GAP2 SYSTEM ..................................................................................................................................268RSI DIVERGENCE EXPLORATION............................................................................................269STIX INDICATOR ........................................................ ............................................................ .....270DENVELOPE (RSI) ......................................................... ........................................................... ........270

    CYLICAL SYSTEM ................................................................ ....................................................... 271JKCYCL.............................................................................................................................................272ST OSCILLATOR...........................................................................................................................273CCI SPIKE TRADING SYSTEM ...........................................................................................................273LOOKBACK ......................................................................................................................................274MCCLELLAN OSCILLATOR ...............................................................................................................276MCCLELLAN SUMMATION INDEX.....................................................................................................276BARNES' ACCELERATION .................................................................................................................278BARNES' ADAPTIVE FORECAST ........................................................................................................278BARNES' MOVING AVERAGE ............................................................................................................278NATENBERG'S VOLATILITY ..............................................................................................................279TEMA STOCHRSI FORMULA .............................................................................................................280DEVSTOP........................................................ ........................................................... ....................280

    WEEKLY PIVOT POINT......................................................................................................................281STO RSI ..................................................... ........................................................... .......................... 282

  • 8/6/2019 Formule - Metastock

    5/554

    5

    ATR MODIFIED.............................................................................................................................283HIGHEST HIGH SINCE BUY SIGNAL........................................................................................283MINERS STORSI..............................................................................................................................284FORECAST OSCILLATOR SYSTEM ALTERNATIVE..............................................................287MURREY MATH ................................................................................................................................287

    ZIGZAG CODE..............................................................................................................................289TRADE EQUITY AND TRADE STOP FORMULA UPDATE .......................................................................292

    SO MUCH FOR QUICK FIXES. MY THANKS TO DAVID HOBBS FORLETTING ME KNOW THAT MY 'ND' VARIABLE FIX WAS ALSO FLAWED.I'LL TRY AGAIN. IF YOU HAVE VERSION 3.X TRADE EQUITY OR TRADESTOP FORMULAS WITH AN 'ND' THAT LOOKS LIKE EITHER OF THE LINESBELOW, ND:=LASTVALUE(INT(FRAC(CP/100)*10)); ORND:=LASTVALUE(INT(FRAC(CP/99)*10)); THEN IT SHOULD BE CHANGEDTO ND:=LASTVALUE(INT(0.1+FRAC(CP/100)*10)); HOPEFULLY THIS WILLFIX THE PROBLEM ONCE-AND-FOR-ALL. ...................................................................297

    LATCHES ..........................................................................................................................................297TRADESTATION CODE..................................................................................................................302

    SLOWKCLASSIC ...............................................................................................................................302MACD HISTOGRAM.........................................................................................................................302HIGH OF TODAY................................................................................................................................303MACD CROSSOVER CHART.............................................................................................................304COLESS RANGE ...............................................................................................................................304INDICATOR COLE'S RANGE DAILY....................................................................................................3058 PERIOD DONCHIAN CHANNEL MID-POINT LINE .............................................................................305INDICATOR SUPP-RESIS DAILY ........................................................................................................305ANDREWS PITCHFORK.....................................................................................................................307E-MINI WITH MONTE CARLO ...........................................................................................................311

    HURST EXPONENT ............................................................................................................................313ERGOTIC CSI....................................................................................................................................314ERGOTIC MACD ............................................................. .............................................................. ...315ENTRY & EXIT .................................................................................................................................316STOPS IN EDS ..................................................... ........................................................... ................317TRIGGERS BASED ON ENTRY PRICES..................................................................................................318COUNT OF ........................................................................................................................................318COMPARE TWO INDICES ...................................................................................................................318COLOUR STUDIES .............................................................................................................................319RECURSION.......................................................................................................................................320DIFFERENT RESULTS IN TRADESTATION ..........................................................................................325SIGNAL REVIEW UPSIDE................................................................................................................3263 BAND RESEARCH SYSTEM .............................................................................................................326

    MARKET PROFILE.............................................................................................................................327T BOND SYSTEM ..............................................................................................................................334HIGHER HIGHS...................................................................................................................................334INDICATOR MARKS..........................................................................................................................335YESTERDAYS HIGH LOW ON AN INTRADAY CHART ........................................................................336TO COUNT THE NUMBER OF NEW HIGHS IN THE LAST N BARS ............................................................336COMMENTARY FUNCTION ................................................................................................................337NO PLOT() STATEMENT....................................................................................................................338NUMERICAL ACCURACY...................................................................................................................340TRADESTATION: RELATIVE VIGOR INDEX ................................................................. .........340STOPS ...............................................................................................................................................341ADAPTIVE STOP................................................................................................................................341LINE THICKNESS WONT RESPOND ..................................................................................................342

    TEXT STUDIES ..................................................................................................................................342@Text Current C

  • 8/6/2019 Formule - Metastock

    6/554

    6

    @TextCurrentCText....................................................................................................................344@TextCurrentIndic...................................................... ............................................................... 345

    TRADESTATION INSTABILITY ...........................................................................................................346

    OTHER HOW TOS ......................................................... ................................................................. 347

    TS4 INSTALLATION ON WIN 2K........................................................................................................349

    ATR DISCUSSION.............................................................................................................................355CODING VELOCITY AND ACCELERATION ...........................................................................................356

    WEALTHSCRIPT CODE.................................................................................................................357

    DEAD CAT CATCHER........................................................................................................................357INTRADAY........................................................................................................................................358WEALTHSCRIPT CODE......................................................................................................................358

    WEALTHSCRIPT CODE.................................................................................................................360

    TURTLE SOUP WITH FILTER ..............................................................................................................360WEALTHSCRIPT CODE......................................................................................................................361MULTI COLOUR MA ETC..................................................................................................................363DIVERGENCE BETWEEN PRICE AND RSI OR MACD HISTO...? ..................................................... ......364

    CHECK PEAK & CHECK VALLEY ......................................................................................................368MOVING AVERAGES .........................................................................................................................371FIBONACCI FORMULAS .....................................................................................................................373JOE DINAPOLI - DINAPOLI TREND FORMULA ...................................................................................376FORECAST OSCILLATOR ...................................................................................................................390CHANDE'S DYNAMIC MOMENTUM INDEX.........................................................................................392ADAPTIVE SYSTEMS .........................................................................................................................394ON BALANCE VOLUME.....................................................................................................................399

    BOOK LIST........................................................................................................................................401

    GANN ...............................................................................................................................................401LIST OF BOOKS AND COURSES:..........................................................................................................401RWI .................................................. ........................................................... .................................... 405

    KNEWPEAKINDICATOR........................................................ ....................................................... 406

    KPEAK OSCILLATOR ........................................................ ............................................................ 406

    OKS & PEAKOSCILLATOR...........................................................................................................407

    KCD INDICATOR.............................................................................................................................407

    KPERM FN.........................................................................................................................................408

    1ST CLASS SHORTS ........................................................ ........................................................... .....408

    1ST CLASS LONGS............................................................................................................................409

    KCDL PIERCING ............................................................ ............................................................ .....410

    {BULLISH PIERCING} ...................................................... ........................................................... ......410{BEARISH PIERCING} ...................................................... ........................................................... ......411

    KSDANGERLONG & SHORT .......................................................... .............................................. 411

    KS2 LONGS & WARNING ........................................................... ................................................... 411

    KS2 SHORTS & WARNING ........................................................... ................................................. 412

    PERMISSION STOCHASTIC..........................................................................................................414

    XPERMD ............................................................ ................................................................. ...............414

  • 8/6/2019 Formule - Metastock

    7/554

    7

    XPERM K ............................................................... ............................................................. ...............414

    XPERM LONG...................................................................................................................................414

    XPERM SHORT ......................................................... .................................................................. .....415

    XD ........................................................................................................................................................415

    XKCD ......................................................... ............................................................ ............................. 416

    KPERMISSIONFN .................................................. ........................................................... ...............416

    KDEVSTOPS......................................................................................................................................416

    XDEV...................................................................................................................................................417

    XREV...................................................................................................................................................417

    LARRY WILLIAMS EXPERT ....................................................... ................................................. 418

    DEMARK EXPERT...........................................................................................................................420

    ZIG ZAG TREND INDICATOR .............................................................................................................423Expressing Exponential averages in days...................................................................................428

    FIBONACCI FORMULAS .....................................................................................................................442JOE DINAPOLI - DINAPOLI TREND FORMULA ...................................................................................444FORECAST OSCILLATOR ...................................................................................................................457CHANDE'S DYNAMIC MOMENTUM INDEX.........................................................................................460ADAPTIVE SYSTEMS .........................................................................................................................461ON BALANCE VOLUME.....................................................................................................................466MARKET COMMENTARY...................................................................................................................467ACTIVE TRADER MAGAZINE CODE ..................................................................................................468

    ROSS CONGESTION PAINTBAR. ............................................................ ............................................. 489NARROW RANGE 4 (NR4) DAYS ......................................................................................................490NARROW RANGE 7 (NR7) DAYS ......................................................................................................491HISTORICAL VOLATILITY .................................................................................................................492BOLLINGER BANDS ..........................................................................................................................493OUTSIDE DAY, NR4 AND MOVING AVERAGE ..................................................................................494NR7, INSIDE DAY AND BOLLINGER BAND .......................................................................................495STOWELLS THREE-BAR NET LINE .....................................................................................................499NONLINEAR EHLERS FILTER.............................................................................................................505NEW MARKET PARADIGM SYSTEM ....................................................................................................508BETTER BOLLINGER BANDS BY DENNIS MCNICHOLL ......................................................................510KLINGER VOLUME OSCILLATOR ......................................................................................................512TPF_REVERSAL2002 ..................................................... ........................................................... .......514

    {MARKET DIRECTION}.....................................................................................................................517REAL TIME PIVOT 2000....................................................................................................................518VOLATILITY STOP INDICATOR ..........................................................................................................519CLUSTER 20000................................................................................................................................521REVERSAL INDICATOR ......................................................................................................................522HI LO PIVOTS ...................................................................................................................................523INTRADAY HI LO .............................................................................................................................524PB LONG ..........................................................................................................................................525PB SHORT ........................................................................................................................................527RUBBER BAND2................................................................................................................................529SFD..................................................................................................................................................530SFK..................................................................................................................................................531SSD..................................................................................................................................................531

    CLUSTER VOLATILITY STOP USES CLUSTER 2000 AS A FUNCTION .................................................532CLUSTER 2000.................................................................................................................................534

  • 8/6/2019 Formule - Metastock

    8/554

    8

    REVERSAL INDICATOR ......................................................................................................................535CLUSTER INDICATOR CODE ...............................................................................................................535CANDLESTICK PATTERN RECOGNITION ............................................................................................536TFS TREND FOLLOWING SYSTEM ....................................................................................................544TETHERLINE.....................................................................................................................................545VOLUME OSCILLATOR......................................................................................................................546

    DOUBLE STOCHASTIC.......................................................................................................................546RINA DATA COLLECTION PORTFOLIO OUTPUT ...............................................................................547WILL SPREAD ...................................................................................................................................551MAMA FAMA................................................................................................................................551ACTIVE INVESTING ...........................................................................................................................553

  • 8/6/2019 Formule - Metastock

    9/554

    9

    AIQ Code

    CANDLESTICKS

    See Separate file

    CANDLESTICKCOLOUR STUDY

    !Colour Study

    GreenCandle if ([Open][Close]).

    GreenBar if ([close]>=val([close],1)).RedBar if ([close] valresult(highbody,2).gapdn if valresult(lowbody,1) < highbody.

    islandReversal if gapup and gapdn.!===================================================

    I have not tested this. I hope it is correct.

    Almost correct... just reverse the UDFs:gapdn if highbody < valresult(lowbody,1).

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++

    RATE OF CHANGE

    ! [email protected] august 2000 www.pewd.com! ROC indicator (rate of change)! source: TA from A-Z, S. Achelis www.equis.com/free/taaz/! change value of nbrdays to change number of days in indicator originally coded for12 period ROC

    define nbrdays 12.closexago is val([close],nbrdays).

  • 8/6/2019 Formule - Metastock

    10/554

    10

    roc is (([close]-closexago)/closexago)*100.

    rocaverage is simpleavg(roc,21).

    check my code for accuracy before trading off of them

    MONEYMANAGEMENTEXITS

    !! Exits Start Here !!

    losslimit is 1.25. !! This controls the stop loss limit.stesa is expavg([close],5).stoploss if val([high],1) >={position entry price} * losslimit.profitarget if val([low],1) = {position entry price} * losslimit or [low] val([macd],0)and val([macd],1)>0

  • 8/6/2019 Formule - Metastock

    11/554

    11

    and val([macd],2)>0and [macd]>0and HiVal([Macd],20)=val([macd],1).

    CONDITIONAL RULES-SELLING PRESSURE

    I did more work on this and now it works for all the stocks in my

    database with look

    back of 22 days-all of my stocks showed at least 4 up days in a 22

    day look back

    period from today:

    !=============================

    !Selling Pressure 4 day average in 22 day lookback:

    ORg is [open]-[low].

    UpC if [close]>val([close],1).

    A1 is Sum(ORgUpC,4)/4.

    A2 is Sum(ORgUpC,5)/4.

    A3 is Sum(ORgUpC,6)/4.

    A4 is Sum(ORgUpC,7)/4.

    A5 is Sum(ORgUpC,8)/4.

    A6 is Sum(ORgUpC,9)/4.

    A7 is Sum(ORgUpC,10)/4.

    A8 is Sum(ORgUpC,11)/4.

    A9 is Sum(ORgUpC,12)/4.

    A10 is Sum(ORgUpC,13)/4.

    A11 is Sum(ORgUpC,14)/4.

    A12 is Sum(ORgUpC,15)/4.

    A13 is Sum(ORgUpC,16)/4.

    A14 is Sum(ORgUpC,17)/4.

    A15 is Sum(ORgUpC,18)/4.

    A16 is Sum(ORgUpC,19)/4.

    A17 is Sum(ORgUpC,20)/4.

    A18 is Sum(ORgUpC,21)/4.

    A19 is Sum(ORgUpC,22)/4.

    Cup1 if countof(UpC,4)=4.

    Cup2 if countof(UpC,5)=4.

    Cup3 if countof(UpC,6)=4.

    Cup4 if countof(UpC,7)=4.

    Cup5 if countof(UpC,8)=4.Cup6 if countof(UpC,9)=4.

    Cup7 if countof(UpC,10)=4.

    Cup8 if countof(UpC,11)=4.

    Cup9 if countof(UpC,12)=4.

    Cup10 if countof(UpC,13)=4.

    Cup11 if countof(UpC,14)=4.

    Cup12 if countof(UpC,15)=4.

    Cup13 if countof(UpC,16)=4.

    Cup14 if countof(UpC,17)=4.

    Cup15 if countof(UpC,18)=4.

    Cup16 if countof(UpC,19)=4.

    Cup17 if countof(UpC,20)=4.

    Cup18 if countof(UpC,21)=4.

  • 8/6/2019 Formule - Metastock

    12/554

    12

    CountUp is countof(UpC,22).

    Avg4day is

    iff(Cup1,A1,iff(Cup2,A2,iff(Cup3,A3,iff(Cup4,A4,iff(Cup5,A5,iff(Cup6,

    A6,

    iff(Cup7,A7,iff(Cup8,A8,iff(Cup9,A9,iff(Cup10,A10,iff(Cup11,A11,

    iff(Cup12,A12,iff(Cup13,A13,iff(Cup14,A14,iff(Cup15,A15,iff(Cup16,A16

    ,

    iff(Cup17,A17,iff(Cup18,A18,A19)))))))))))))))))).

    !The following is to display data to test calculation of average:

    ORgUpC is IFF(UpC,ORg,0).

    ORgUpC1 is valresult(IFF(UpC,ORg,0),1).

    ORgUpC2 is valresult(IFF(UpC,ORg,0),2).

    ORgUpC3 is valresult(IFF(UpC,ORg,0),3).

    ORgUpC4 is valresult(IFF(UpC,ORg,0),4).

    ORgUpC5 is valresult(IFF(UpC,ORg,0),5).

    GoodData if HasDataFor(255)>=252 and expavg([volume],50)>3000and [close]>=5 and mover and not ScanAny(GapDown,20) and

    resetdate() and

    CountUp>=4.

    GapDown if Val([low],1) - [high]>2.

    Look if [ADX]>30 and [DirMov]>0 and Avg4day 4.

    BigMover if avgrat>8.

    List if 1=1.

    MOMENTUM

    ! [email protected] august 2000 www.pewd.com! momentum indicator

    ! sources: TA from A-Z, S. Achelis www.equis.com/free/taaz/! MarketTrack-MX user manual, page 10-16 (Track Data Corp)

    define nbrdays 12.momentum is ([close]/val([close],nbrdays))*100.

    check my code for accuracy before trading off of them

  • 8/6/2019 Formule - Metastock

    13/554

    13

    VIDYA - TUSHAR CHANDE

    Here's Vidya based on a 9-period CMO, or as close as we can get given > TEP'slimitations for recursive calculations. Change VidLen to vary > the > (nominal) lengthof the moving average. As an indicator it is very > slow > to calculate, but is not bad

    in a scan.

    > > HHP

    ! (based on 9-period CMO).!==================================

    Define CMOLen 9. ! Conventional value is 9.

    Define VidLen 12. ! Smoothing. Vary to suit.

    Define Itr 100. ! Iterations allowed (maximum 240).

    !=============================

    MO is [Close] - Val([Close], 1).AbsMO is Abs(MO).AbsCMO is 0.01 + Abs(Sum(MO, CMOLen)) / (Sum(AbsMO, CMOLen) + 0.01).

    Alpha is (2 / ((1 + VidLen)) * AbsCMO).

    Beta is 1 - Alpha.

    DaysInto is ReportDate() - RuleDate().Stop if DaysInto > Itr.StopCalc is iff(Stop, [Close], Vidya).

    Vidya is Alpha * [Close] + Beta * ValResult(StopCalc, 1).

    !===================================

    SECTORMOVEMENT

    Steve, Quite correct to point out this market has no intrinsic worth of 5000 and thetrip back to that level may take years, I meant that because it is a long trip, I'm not in ahurry to jump on the first train that leaves. There will be plenty of opportunity tocatch a tech wave or two. The sector rotation formula is very simple, but it hasbacktested better than TS for the way I am using it. It mostly fires at the beginning ofa shift in leadership, and is best with 20 day holds or so. The gifs will show you whatit looks like, and it doesn't look very good because it fires for a few days and thendrops. It is only used to fire a good sector signal, the stock sell is based on stock

    action, not a drop in the sector signal.!==========================================================

  • 8/6/2019 Formule - Metastock

    14/554

    14

    !GROUP & SECTOR STUFF ! Rich set up formDescription is Description().GroupSymbol is TickerUDF(RSTicker(),Symbol()).GroupName is TickerUDF(RSTicker(),Description).

    SectorSymbol is TickerUDF(RSTicker(),GroupSymbol).SectorName is TickerUDF(SectorSymbol,Description).SectorTCIDIR is TickerUDF(SectorSymbol,TCIDIR).GroupTCIDIR is TickerUDF(GroupSymbol,TCIDIR).

    TCIDIR is (( [TCI]-val([TCI],1))*10 )+ [dirmov]-60. !combines the TCI and the

    DIRMOV to find quik trend

    Tech if SectorSymbol="MGTECHNO". !I set up my sectors based on the 10

    Market Guide sectors,but any will workNOTECHNOSECTOR if not tech.

    notech if NOTECHNOSECTOR and SectorTCIDIR>=0. ! used to keep techs outof the game if the NASDAQ is on a decline! but any other sector that shows life will be active for a few days.

    !ALL weather for month long 20 stocks

    !will switch to non-tech sectors if they are hot when combosig=-1!..code for stock picking--last few criteriaand [TCI]

  • 8/6/2019 Formule - Metastock

    15/554

    15

    Weighted Action List Report

    attached are the action and weighted action reports, in eds, which is realclose to the system supplied reports (report module). change the constantsto match what you usually run on reports, and don't forget to change towhatever list you want to run for (file/properties).

    2 report tabs, 1 for wa report, another for the action report, both upsideversions. i didn't code the downside reports. and i should note, AIQwrote the original EDS - i just fixed it and modified it slightly, theoriginal work is AIQ's, not mine.

    note that there are a few oddities in the wa report, not reflected in the

    code - this version of the code matches the report as close as i can get it,at least till the next time someone prompts me to look at it ;)

    first oddity - wa report looks back x days, action report looks back x+1days, for looking for an up er.

    next item, in the report (and attached eds) the system does not look for aphase reversal upside followed a day or 2 later by a reversal downside,followed by another reversal up. it does make sure phase is currently goingup, but doesn't check for whipsaws (up/down/up). if i recall correctly, youwill occasionally see stocks on the weighted action report which have had aupside phase reversal a few days ago, followed by a downside reversal a dayor 2 later, then another up. personally, i don't trade such stocks. your

  • 8/6/2019 Formule - Metastock

    16/554

    16

    mileage may vary, disclaimer, do what you will with it , i'm not liable (toomany lawyers in my family i guess :) )

    the other thing i'm not checking for in the code is an up er followed a few

    days later by a down er. an example would be yhoo - up er on 1/3, down eron 1/11, yet its on the report. same comment as above. i disagree with thereport specs in this case - i don't want to see it if an up er has beenfollowed by a down one, regardless of current phase direction. othershowever would view the down er as unconfirmed, and thus a non signal, due tolack of down phase action, so they remain on the report. other versions ofthis EDS that i've passed around in the past do check for an interveningdown er, and exclude such stocks - this version doesn't as i tried to matchthe report. same disclaimer, check your charts before pulling the trigger.

    ! -----------------------------------------------------------------------------------------------! eds to match weighted action report! modified by pewd from original version supplied by AIQ! check what settings you have on wt act rpt if youre trying to match this eds to thereport,! eg., make sure youre running for the same list, price, and volume filters as on the wt.act. report!! ER to upside 95 or greater last 10 days confirmed by change in direction of the PricePhase indicator in the last 3 days.!! modifications to original (aiq) version:! pewd 7/99 added price filter, $10 and up! pewd 7/99 added volume filter, 100,000 shares and up! pewd 7/99 changed up er lookback from 10 to 6! pewd 7/99 corrected logic error in PhaseChangeUp test, eliminate stocks that turnedphase down on report date! pewd 7/99 added 4th day to PhaseCHANGEUPup rule to match reports module! pewd 7/99 added er, price, and a few other columns to report! pewd 1/01 added action report tab, cleaned up my sloppy code from 99

    ! -------------------------------------------------------------------------------------------------------------------------------

    ! define report constantsdefine minprice 10. ! minimum pricedefine minvolume 1000. ! minimum volume, in lots (x 100)define nbrdays 11. ! nbr days to look for an up erdefine miner 90. ! minimum er value to triggerdefine nbrphasedays 4. ! number of days to look back for phase reversal

    ! check for minimum price

    pricefilter if [close]>=minprice.

  • 8/6/2019 Formule - Metastock

    17/554

    17

    ! check for minimum volumevolumefilter if [Volume ESA] > minvolume.

    phasereverse if val([phase],1)val([phase],1).goodphase if ^[phase]>^val([phase],1).

    phasechangeup if scanany(phasereverse,nbrphasedays) and goodphase.

    ! look for ER buy signalWA_Report_Up if HiVal([ER UP],nbrdays) >=MinER and PhaseChangeUp andPriceFilter and VolumeFilter.Action_Report_Up if HiVal([ER UP],nbrdays-1) >=MinER and PhaseChangeUp andPriceFilter and VolumeFilter.

    ! report columns!pewd july 99UpER is hival([ER UP],nbrdays).

    Exch is MarketCode().Change is [close]-val([close],1).Security_name is Description().Trend is [TS].DeltaTrend is [DTS].GroupSymbol is TickerUDF(RSTicker(),Symbol()).GroupName is TickerUDF(RSTicker(),Security_name).GroupTS is TickerUDF(RSTicker(),Trend).GroupDTS is TickerUDF(RSTicker(),DeltaTrend).SectorSymbol is TickerUDF(RSTicker(),GroupSymbol).SectorName is TickerUDF(SectorSymbol,Security_name).SectorTS is TickerUDF(SectorSymbol,Trend).SectorDTS is TickerUDF(SectorSymbol,DeltaTrend).

    PRICE/VOLUME CRITERIA?

    Gap is IFF([low]>Val([High],1) and ([low]/Val([High],1))>=1.15 and([close]/Val([High],1))>=1.15,1,0).

    Keep if [volume esa]>500 and Sum(Gap,100)=0 and Countof([volume]>0,100)>=98.

    HIGHJUMP CANDIDATE SELECTION

    I wrote the HighestHighJump scan and I use it just as you do to develop a list oftrading candidates.

    The inventor of the HJ indicator is Ian Woodward. He uses it as a gauge of how

    extended a stock is off its base. When the numbers get over certain cutoffs (on acurrent basis), he says there is a high danger of a major correction in the stock.

  • 8/6/2019 Formule - Metastock

    18/554

    18

    After I programmed the indicator in AIQ, I noticed that some stocks got to muchhigher HJ numbers than others. I also noticed that most of the High Growth stocksthat Ian (and William O'Neil) define by other means (eg EPS rank, RS and Group RS

    etc) could be defined by a high peak readings in their maximum HJ levels. So I wrotethe scan that looks back and picks out the highest reading over a lookback period offive years or less if less trading history. The ones with the highest readings werealways the high growth and/or momentum stocks. What this indicator does is measurethe ability of a stock to rise rapidly. The higher the reading the faster the stockhas been able to climb.

    I am working on additional ways to develop trading lists and I will post more on thiswhen I have time. I asked other traders to propose how they would go aboutdevelopinga short list of stocks. I received several good suggestions and I want to thank those

    who contributed.

    Here is the code for the HJ (but not the Highest High Jump) for those of you who arewondering what it is:

    !HIGH JUMP INDICATOR - from Ian Woodward!For Ian Woodward's standard HighJump set ST MA to 17, IT MA to 50, LT MA to200.STMA is simpleavg([close],17).ITMA is simpleavg([close],50).LTMA is simpleavg([close],200).STdmaPct is ([close]-STMA)/STMA*100.ITdmaPct is ([close]-ITMA)/ITMA*100.LTdmaPct is ([close]-LTMA)/LTMA*100.Highjump is STdmaPct + ITdmaPct + LTdmaPct.

    VOLUME SPIKE

    *******************!ER is 95 or above within last 5 days!Strength of Group is based on trend score , or high positive value for DTS! P-Vol is higher than yesterday and todays P-Vol is higher than its ESA.! Spike if volume is 50% above the ESA of volume!Buy the stock when all rules are passed.TS is [TS].DTS is [DTS].Description is Description().GroupDTS is TickerUDF(RSTicker(),DTS).GroupTS is TickerUDF(RSTicker(),TS).

    Group is TickerUDF(RSTicker(),Description).

  • 8/6/2019 Formule - Metastock

    19/554

    19

    GroupTSHigh if GroupTS>90.GroupDTSHigh if GroupDTS>20.ERUP if HiVal([er up],5) >= 95.PVolUP if VAL([P-Vol],1) < [P-Vol] and [P-Vol] > [P-Vol ESA] .VolSpike if [volume] >= [volume esa] * 1.5.

    BuyMid2 if HiVal([er up],5) >= 95 and PVolUP and VolSpike and (GroupTSHigh orGroupDTSHigh)***********************************

    VARIABLEPROFITPROTECTSTOP, LOSS STOP AND TIME STOP

    !Variable Profit Protect Stop, Loss Stop and Time Stop! Coded by Rich Denning! Date: 3/10/2001! This file was written for the AIQ Yahoo Groups Message Board and is fordemonstration! and educational purposes only. Distribution outside of this message board or use! in commercial applications is prohibited.! If any of this file is copied, in part or in whole, this header must be included with it.!The following requires AIQ version 6.0 and can only be used as an exit rule in abactest of a simulationP is {Position Days}.MaxProfitR is {Position High Price}/{Position Entry Price}.Profit is [close]-{Position Entry Price}.MaxProfit is HighResult(Profit,P).Stop1 is {Position Entry Price}+MaxProfit*0.70.Stop2 is {Position Entry Price}+MaxProfit*0.80.Stop3 is {Position Entry Price}+MaxProfit*0.90.Stop4 is {Position Entry Price}+MaxProfit*0.95.Stop5 is {Position Entry Price}+MaxProfit*0.98.Stop6 is {Position Entry Price}+MaxProfit.! Protect 70% of profit above 50%! Protect 80% of profit above 60%! Protect 90% of profit above 70%! Protect 95% of profit above 80%

    ! Protect 98% of profit above 90%! Protect 100% of profit above 100%ProfitProtect if [close]1.5 and MaxProfitR1.6 and MaxProfitR1.7 and MaxProfitR1.8 and MaxProfitR1.9 and MaxProfitR2.0,Stop6,0)))))).LossStop if [close]=20.MasterExit if ProfitProtect or LossStop

  • 8/6/2019 Formule - Metastock

    20/554

    20

    BUY FOR STOCKS IN A SECTOR

    !Scan for DTUniversityPrice if [close]19.AvgVol is [Volume ESA].Vol if ExpAvg(AvgVol,14)>1200 AND [Volume]>1200.

    !To-days rangeRange is [high]-[low].HighRange If ExpAvg(Range,14)>4 AND Range>4 .CCIUp IF Slope([CCI],5)>0 AND [CCI]>0.Avgvcrossover IF [ST ESA]>[IT ESA] AND ( Val([ST ESA],1) =====================================> varudf is [close].> variance is Variance(varudf,21).> stddev is Sqrt(Variance).> ma is SimpleAvg(varudf,21).>> UpperBB is 2 * StdDev + ma.> LowerBB is ma - 2 * StdDev.

    > =======================================

    Slope etc

    While I am at it...here is something that is VERY valuable to your bag of EDS tricks.It is the calculation used to calculate the internal function "slope". The math may beway over some peoples heads,but the most important thing about having this is theability to calculate the INTERCEPT point!

    Alan Nathan asked about doing Standard Deviation lines based on the linear

    regression line. In order to do this you must have the intercept point. So I coded theinternal Slope function in EDS so you can now have this. I put together an EDS file

  • 8/6/2019 Formule - Metastock

    21/554

    21

    that does the math, and creates "bands" based on 2 standard deviations above/belowthe intercept point of the linear regression line. I hope this is close to what Alan hasasked for. You can put UpperSD and LowerSD and Intercept as Custom Indicatorsand plot the bands.

    ! Author: Dale Paul (AIQ)! Date: 4/7/2001! How to calculate a slope and intercept using linear regression

    ! how many days are we running this for?define constdays 4.days is HasDataFor(constdays).

    ! value (in this case the close)varudf is [close].

    LINEAR REGRESSION CALCULATION USING THELEASTMEANS SQUARED METHOD

    day is offsettodate(month(),day(),year())+1.dayX2 is day * day.

    sx is Sum(day,days).sx2 is Sum(dayX2,days).sy is Sum(varudf,days).sxy is Sum( day * varudf ,days).d is ( days * sx2) - (sx * sx).

    slope is ((days * sxy) - ( sx * sy)) / -d. ! same result as internal Slope functionb is ((sx2 * sy) - (sx * sxy)) / d.

    Intercept is slope + b.

    ! get the standard deviation of the closevariance is Variance(varudf,days).stddev is Sqrt(Variance).

    ! Compute our Deviation BandsUpperSD is 2 * StdDev + Intercept.LowerSD is Intercept - 2 * StdDev.

    all if 1.

    LINEARREGRESSION METHOD BASED INDICATORS

    There was an error in my linear regression code--the intercept was claculated

    incorrectly. Thanks to John R for pointing this out.The correct eds code is

  • 8/6/2019 Formule - Metastock

    22/554

    22

    define TimeFrame 30.b is slope([close],TimeFrame).intercept is sum([close],TimeFrame)/TimeFrame - (b * (TimeFrame+1)/2).expectedLast is intercept + (TimeFrame*b).

    SECTORDIVERGENCE

    !!! Sector Divergence!!! EDS Author. Ron Stockstill!!! Date. 4/9/2001.

    !!! Define constants

    define slopelen 20. ! determine length of lookback for slope function to see if adivergence in pricedefine divpct 15. ! set divergence percentage

    Sym is symbol().Desc is description().GroupSym is TickerUDF( RSTicker(),symbol()).SectorSym is TickerUDF( RSTicker(),groupsym).

    stock if stock(). ! Only want stock symbols.MedSector if SectorSym = "medical". ! Check for medical sector

    TechSector if SectorSym = "electric".

    Biotech if GroupSym = "medic1". ! AIQALL list uses medic1 forbiotechSemi if GroupSym = "Elect10".

    Slope is Slope([close], slopelen). ! Calculate slope of linearregression lineGroupSlope is TickerUDF(groupsym,slope). ! Calculate slope of linearregression line for group symbol

    groupstock if Semi or Biotech. ! Only want symbols fromsemiconductors or biotechs

    Pctgain is 100*([close] - Val([close],slopelen))/Val([close],slopelen). !Calculate percent gain using slope length as lookback period.groupPctGain is TickerUDF(groupsym,Pctgain).

    Totalgain is Pctgain + ABS(groupPctGain). ! Use Absolute value as a negativeslope will normally but not always have a negative return.

    !! Code Positive Divergence using Slope

  • 8/6/2019 Formule - Metastock

    23/554

    23

    Diverge if stock andgroupstock andSlope > 0 andGroupSlope < 0 andTotalgain > divpct.

    COUNTOF

    Rule if [close] > simpleavg([close],20).CountRule if Countof(Rule,1)=1 and Countof(Rule,2) =1. ! False on dayn+2; True on day n+1

    ================================================

    Tom,

    Rule is true if close is greater than the 20 day sma.Now suppose you have two days in a row of closes above 20 day sma.Rule will be true for today and also Rule will be true for yesterday.Thus Countof(Rule,2) will = 2 (1 + 1). Thus, Countof(Rule,2)=1 will beFALSE.

    Now CountRule is only true whenyesterday is FALSE and today is TRUE. If today is below themoving average, the Countof(Rule,1) will be zero and CountRule willbe false. This leaves the only combination that CountRule can betrue; yesterday below the SMA and today above the SMA.

    You could have used Valresult(rule) 1 and rule=1 for CountRule.

    ATRAND WILDERSRSI

    !==========================!!! Average True Range.

    TR is Max([High], Val([Close], 1)) - Min([Low], Val([Close], 1)).ATR27 is ExpAvg(TR, 27). !! Equivalent to ATR14 using Wilder'ssmoothing.

    !========================PlusDM1 is [High] - Val([High], 1).PlusDM2 is Max(PlusDM1, 0).PlusDM is PlusDM2 * (PlusDM2 > MinusDM2).

    AvgPlusDM is ExpAvg(PlusDM, 27).

  • 8/6/2019 Formule - Metastock

    24/554

    24

    PlusDMI is AvgPlusDM * 100 / ATR27. !! Plot wuth MinusDMI as 2-lineindicator.

    MinusDM1 is Val([Low], 1) - [Low].

    MinusDM2 is Max(MinusDM1, 0).MinusDM is MinusDM2 * (MinusDM2 > PlusDM2).AvgMinusDM is ExpAvg(MinusDM, 27).

    MinusDMI is AvgMinusDM * 100 / Atr27. !! Plot with PlusDMI as 2-lineindicator.

    DlDiff is PlusDMI - MinusDMI. !! Plot as histogram. Same as AIQ'sDirMov.DlSum is PlusDMI + MinusDMI.DX is Abs(DlDiff) * 100 / DlSum.

    ADX is ExpAvg(Dx, 27). !! PLOT ADX as single line indicator withsupport at 24, same as AIQ's ADX.

    !==========================

    RELATIVE STRENGTH

    !RELATIVE STRENGTH STUDY by Rich Denning 10/23/99!Run against your group or sector structure by clicking on file, properties, then put ingroup list eg AIQALL and check groups only

    !Indicatior for ranking RS of stocks, groups or sectors (you can set these up a customindicators on the charts)

    RS4 is SLOPE([RS Indx],4)*100.RS9 is SLOPE([RS Indx],9)*100.RS17 is SLOPE([RS Indx],17)*100.RS50 is SLOPE([RS Indx],50)*100.RS200 is SLOPE([RS Indx],200)*100.RScomposit is RS17 + RS50 + RS200.

    !Is trend up or down in various time frames? my settings are st=17, it=50, lt=200STtrend is SLOPE([st ma],5).ITtrend is SLOPE([it ma],5).LTtrend is SLOPE([lt ma],5).

    !List of all tickersList if 1=1.

    Description is description().Group is TickerUDF(RSTicker(),Description).

    Sector is TickerUDF(RSTicker(),Group).

  • 8/6/2019 Formule - Metastock

    25/554

    25

    !List of positive relative strength tickers (short term)Define Length1 17. ! Or 4,9RS1 is 100*SLOPE([RS Indx], length1).STposRS if RS1 > 0.

    !List of positive relative strength tickers (long term)Length2 is 200. !Or 50, 100RS2 is SLOPE([RS Indx],length2)*100.LTposRS if RS2 > 0.

    !List of negative relative strength tickers (short term)STnegRS if RS1 < 0.

    !List of positive relative strength tickers (long term)

    LTnegRS if RS2 < 0.

    !List all positive tickersAllPos if STposRS and LTposRS and RScomposit > 0 and [DTS]>=0 and [TS]>0

    and [VA pct]>0.

    !List HGS groups onlyHGSgroup1 if 1=1. !Don't know how to do this yet

    !HGSgroup if Symbol() is "COMP1" HGS group includes all Computer,Electrical, Telecom, Medical plus selected others

    RECURSION

    !! Adaptive Moving Average (Perry Kaufman).! (with allowances for AIQ recursion).! EDS code by HHP.

    !*******************************************

    MA Long Term:

    Mov(C,30,E);Mov(C,35,E);Mov(C,40,E);Mov(C,45,E);Mov(C,50,E);Mov(C,55,E);

    MA Short Term:Mov(C,5,E);Mov(C,8,E);Mov(C,11,E);

    Mov(C,14,E);Mov(C,17,E);

  • 8/6/2019 Formule - Metastock

    26/554

    26

    Adaptive Moving Average:period:=Input("Period",1,250,13);DifP:=Abs(C-Ref(C,-1));

    SC:=Power((Abs(C-Ref(C,-period)) / Sum(DifP,period)) * 0.60215{2/3-2/31} +0.06452{2/31},2);AMA:=PREV+(SC*(C-PREV));AMA

    !***********************************************

    Define ERPds 10. ! Efficiency Ratio Periods.

    Define FPds 2.Define SPds 30.

    Dir is [Close] - Val([Close], ERPds).

    dPr is [Close] - Val([Close], 1).Vlty is Sum(Abs(dPr), ERPds).

    ER is Dir / Vlty.

    Fastest is 2 / (FPds + 1).Slowest is 2 / (SPds + 1).

    Smooth is ER * (Fastest - Slowest) + Slowest.

    C is Smooth * Smooth.

    !=====================! EDS Recursion. Original coding by Dale Paul.

    Define RWin 100. ! Recursion window.

    DaysInto is ReportDate() - RuleDate().Stop if DaysInto > RWin.StopADPT is IFF(Stop, [Close], ADPTMA).

    ADPTMA is C * [Close] + (1 - C) * ValResult(StopADPT, 1).

    !========================!! AMA Filter.

    Define FltWin 20. ! Filter Window periods).Define FltPct 15.

    dAMA is ADPTMA - ValResult(ADPTMA, 1).AMAFlt is (FltPct / 100) * Sqrt(Variance(dAMA, FltWin)).

  • 8/6/2019 Formule - Metastock

    27/554

    27

    !=========================

  • 8/6/2019 Formule - Metastock

    28/554

    28

    MetaStock Code

    PRIMARYBUYSIGNAL

    ((MACD()>Mov(MACD(),9,E) AND C>Mov(C,5,E) AND C>Mov(C,15,E))=TRUE)AND(Ref(MACD()>Mov(MACD(),9,E) AND C>Mov(C,5,E) ANDC>Mov(C,15,E),-1)=FALSE)ANDBarsSince(Ref( ((MACD()>Mov(MACD(),9,E) AND C>Mov(C,5,E) ANDC>Mov(C,15,E))=TRUE) AND (Ref(MACD()>Mov(MACD(),9,E) AND

    C>Mov(C,5,E)AND C>Mov(C,15,E),-1)=FALSE),-1))>=BarsSince(Ref(Cross(0.955*Ref(C,-2),C),-1))

    PRIMARYSELL SIGNAL

    Cross(0.955*Ref(C,-2),C) AND

    BarsSince(((MACD()>Mov(MACD(),9,E) AND C>Mov(C,5,E) ANDC>Mov(C,15,E))=TRUE) AND (Ref(MACD()>Mov(MACD(),9,E) ANDC>Mov(C,5,E)AND C>Mov(C,15,E),-1)=FALSE))Mov(MACD(),45,E) AND C>Mov(C,25,E))=TRUE) AND(Ref(MACD()>Mov(MACD(),45,E) AND C>Mov(C,25,E),-1)=FALSE) ANDBarsSince(Ref(((MACD()>Mov(MACD(),45,E) AND C>Mov(C,25,E))=TRUE)AND

  • 8/6/2019 Formule - Metastock

    29/554

    29

    (Ref(MACD()>Mov(MACD(),45,E) AND C>Mov(C,25,E),-1)=FALSE),-1)) >=BarsSince(Ref(Cross(0.9*Ref(C,-7),C),-1))

    Primary Sell Signal

    (Cross(0.9*Ref(C,-7),C) AND BarsSince(((MACD()>Mov(MACD(),45,E) ANDC>Mov(C,25,E))=TRUE) AND (Ref(MACD()>Mov(MACD(),45,E) ANDC>Mov(C,25,E),-1)=FALSE))

  • 8/6/2019 Formule - Metastock

    30/554

    30

    (C / (1 + ((C - Ref(C,-64)) / Ref(C,-64))))AND(C / (1 + ((C - Ref(C,-64)) / Ref(C,-64))))

  • 8/6/2019 Formule - Metastock

    31/554

    31

    {double smoothed stochastic 10 period}{demominators defined to eliminate divide by zero errors}denom1:= If(HHV(H,10)-LLV(L,10)>0, HHV(H,10)-LLV(L,10), 1);P1:= Mov(((C-LLV(L,10))/ denom1)*100,3,E);

    denom2 := If(HHV(P1,10)-LLV(P1,10)>0, HHV(P1,10)-LLV(P1,10), 1);Mov(((P1-LLV(P1,10))/denom2)*100,3,E)

    EXPLANATION OF THEMCCLELLANOSCILLATOR

    (DAILY ADVANCING ISSUES -(minus) DAILY DECLINING ISSUES)= BMcClellan OSC= MOV(B,19,E)- MOV(B,39,E)WHERE: -100 OR LESS IS OVERSOLD (BULLISH)WHERE: +100 OR GREATER IS OVERBOUGHT (BEARISH)Note that B is just a constant for illustration purposes only.Advance Decline Line{To display the Advance Decline Line, create a composite security in TheDownLoader of Advancing Issues minus Declining Issues. Open a chart ofthe composite and plot this formula}Cum(CLOSE)McClellan Oscillator{To display the McClellan Oscillator, create a composite security in TheDownLoader of Advancing Issues minus Declining Issues. Open a chart ofthe composite and plot this custom indicator.}Mov(CLOSE,19,EXPONENTIAL) - Mov(CLOSE,39,EXPONENTIAL)mike arnoldiCMO FILTERCMO Filtered:momu:=If(C>Ref(C,-1),C-Ref(C,-1),0);momd:=If(CA1,C-Ref(C,-1),0);Mdn:=If(Ref(C,-1)-C>A2,Ref(C,-1)-C,0);Periods:=Input("Length",5,100,13);

    CMOF:=100*((Sum(Mup,Periods)-Sum(Mdn,Periods))/(Sum(Mup,Periods)+Sum(Mdn,Periods)));Sig:=Mov(CMOF,10,S);Hist:=CMOF-Sig;Hist;Sig;CMOF;

    THRUSTOSCILATOR:

    AI:= Security("D:\Stocks\Market

    Indicators\X.NASD-A",C);AV:= Security("D:\Stocks\Market

    mailto:[email protected]:[email protected]
  • 8/6/2019 Formule - Metastock

    32/554

    32

    Indicators\X.NASD-A",V);DecI:= Security("D:\Stocks\MarketIndicators\X.NASD-D",C);DecV:= Security("D:\Stocks\MarketIndicators\X.NASD-D",V);

    TO:=(((AI*AV)-(DecI*DecV))/((AI*AV)+(DecI*DecV)))*100;Periods1:=Input("length1",3,100,21);Periods2:=Input("length2",3,100,5);IND:=Mov(TO,Periods1,S);sig:=Mov(IND,Periods2,S);sig;IND;You will have to create securities of advancing issues,declining issues,advancingvolume, declining volume first then type in the directory where they are located

    Henry kaczmarczykTHRUST OSCILLATOR

    the thrust osc, the metastock formulaAI:= Security("D:\Stocks\Market Indicators\X.NASD-A",C);AV:= Security("D:\Stocks\Market Indicators\X.NASD-A",V);DecI:= Security("D:\Stocks\Market Indicators\X.NASD-D",C);DecV:= Security("D:\Stocks\Market Indicators\X.NASD-D",V);TO:=(((AI*AV)-(DecI*DecV))/((AI*AV)+(DecI*DecV)))*100;Periods1:=Input("length1",3,100,21);Periods2:=Input("length2",3,100,5);IND:=Mov(TO,Periods1,S);sig:=Mov(IND,Periods2,S);sig;IND;You will have to have created securities of advancing issues,decliningissues,advancing volume, declining [email protected]

    MIDAS VOLUME WEIGHTEDAVEPRICE-SUPPORT/RESIST

    From P.67, TASC, May 2001MIDAS Volume Weighted Ave Price-Support/resist.}

    sm:=Input("Starting Month",1,12,1);sd:=Input("Starting day of month",1,31,1);sy:=Input("Starting year",1980,2100,2000);start:= sd = DayOfMonth() AND sm = Month() AND sy = Year();pv:= MP()*V;

    denom:=If(Cum(V)-ValueWhen(1,start,Cum(V))=0,1,Cum(V)-ValueWhen(1,start,Cum(V)));

    If(BarsSince(start),(Cum(pv)-ValueWhen(1,start,Cum(pv)))/denom,MP())

  • 8/6/2019 Formule - Metastock

    33/554

    33

    STOCHASTIC CROSS TRADING SYSTEM

    QUESTIONHow would I write a MetaStock System Tester for:Buy: stoch(12,3) has fallen below 36 and then crosses above its 6 day WMA.Sell: stoch(12,3) rises above 52 and then falls below its 3 day WMA OR 3 day WMAof stoch crosses above 55.ANSWERstoch(12,3)52 and cross(mov(stoch(12,3),3,w),stoch(12,3)) ormov(stoch(12,3),3,w)>55

    TSI AND ERGODICS INDICATORS

    Contributed by Christian Baude [email protected] Strength Index (TSI) - "Momentum, Direction and Divergence", William Blau,Pub: John Wiley& Sons (see also TASC Jan '93, "Stochastic Momentum" gives theformula for the true strength index. This article refers to an older article by Blau in theJan '91 TASC "Double Smoothed Stochastics")

    TSI(close,r,s) = 100*EMA(EMA(mtm,r),s / EMA(EMA(ImtmI,r),s)>> Your formula expanded>>100*(Mov(Mov(ROC(C,1,$),25,E),13,E)/Mov(Mov(Abs(ROC(C,1,$)),25,E),13,E))Numerator:mtm = one-day momentum of closer-day EMA of mtm {25 day}s-day EMA {13 day double smoothing}Denominator:ImtmI = absolute value of mtmr-day EMA of ImtmI

    s-day EMA {double smoothing}TSI(close,25,13)Signal Line = EMA(TSI,7)thresholds at +25, 0, -25

    5 day EMA of 20 day EMA of 1 day momentum

    {little lag Vs smoothing of price}Ergodic Oscillator = Ergodic + Signal line {TSI version of Slow Stochastic}Ergodic(close,r) = TSI(close,r,5) {double smoothing is fixed at 5}Signal Line(close,r) = EMA(TSI(close,r,5),5)

    r = 20daysthresholds are +20, -20

    mailto::[email protected]::[email protected]
  • 8/6/2019 Formule - Metastock

    34/554

    34

    Interesting comparison chart between 20 Slow Stochastic and 20 Erodic{more head room in oversold-bought areas}another chart showing Ergodic Osc = TSI(close,32,5) with 5-day EMA signal line

    Trading Ergodics with the Trend Rules

    1. Enter or hold position only when slope of Ergodic Signal line has the samedirection as the trend2. Stand aside when slope of Ergodic Signal Line is in the opposite direction of trend3. Enter or exit position when Ergodic and its Signal Line crossSlow TSI Trend = TSI(close,64,64) {? weekly looking chart - very little lag}Thresholds set at +15 & -15Trading Ergodics with Slow TSI Trend1st window - Slow TSI Trend = TSI(close,64,64)2nd window - Ergodic Osc = TSI(close,64,5)

    RELATIVE STRENGTH OF STOCK TO INDEX

    Here is what I have been using as Relative strength (RSC)Compared to the XAOColumn A: CLOSEColumn B: If( (Ref(Div(CLOSE,P),-4) > Ref(Mov(Div(C,P),30,E),-4)),1,0)Column C: If( (Ref(Div(CLOSE,P),-3) > Ref(Mov(Div(C,P),30,E),-3)),1,0)Column D: If( (Ref(Div(CLOSE,P),-2) > Ref(Mov(Div(C,P),30,E),-2)),1,0)Column E: If( (Ref(Div(CLOSE,P),-1) > Ref(Mov(Div(C,P),30,E),-1)),1,0)

    Column F: (( C/P - Mov(C/P,30,E)) / Mov(C/P,30,E)) * 100Filter: Div(C,P)> Mov(Div(C,P),30,E) AND colB=1 AND colC =1 AND colD = 1AND colE =1I name columns B - E period 1, 2, 3, etc.Open The chart of the index you wish to get the relative strength of the securities onmake periodicity "Week".In the options area of the exploration editor change to Week.This formula will select securities that have outperform the index over the last 5weeks. The formula in column F provides a way to rank the securities in terms of theirrecent performance relative to the index.Frederick W McKenzie

    :[email protected] PARAMETER BOLLINGER BAND

    SYSTEMN:=Input("Lookback Period", 9, 220, 90);M:=N; {Period used for Momentum Index}SD:=1.5; {Number of Stdev's around FlexPivot}MI:= CMO(C ,M ) / 100; { Momentum Index }MA:= Mov(C, N, S); { Moving Average }FlxP := If( MI > 0,{ THEN }

    MA + (MI * (HHV(C, M) - MA)),{ ELSE }

  • 8/6/2019 Formule - Metastock

    35/554

    35

    MA + (MI * (MA - LLV(C, M)))); { ENDIF }LBand := FlxP - SD * Stdev(INDICATOR, N);UBand := FlxP + SD * Stdev(INDICATOR, N);UBand;

    FlxP;LBand;{from Andreas Grau}

    DIVERGENCE TRADING SYSTEMRSI(9) DIVERGENCE BUY:

    If(RSI(9) >= HHV(RSI(9),19) AND CLOSE = HHV(CLOSE,19) AND RSI(9) WITH < WE HAVE THE POSITIVE DAYS .

    COL A: BarsSince(C>Ref(C,-1)) {NUMBER OF NEG. DAYS )COL B: ROC(C, LastValue(BarsSince(C>Ref(C,-1))),%) {PERCENT}

  • 8/6/2019 Formule - Metastock

    36/554

    36

    From "KAKARIDIS NIKOS"

    FIND RSI ABOVE 80

    Col A: RSI(14)Filter colA>=80Filter enabled YesPeriodicity DailyRecords required 18

    KASEDEVSTOP

    Hi Lino,Here is what I found for her Kase DevStop:

    {Cynthia Kase}Per1:=Input("Max Length",2,100,30);

    RWH:=(H-Ref(L,-Per1))/(ATR(Per1)*Sqrt(Per1));

    RWL:=(Ref(H,-Per1)-L)/(ATR(Per1)*Sqrt(Per1));Pk:=Mov((RWH-RWL),3,W);AVTR:=Mov(HHV(H,2) - LLV(L,2),20, S);SD:=Stdev(HHV(H,2) - LLV(L,2),20);Val4:=If(Pk>0,HHV(H-AVTR-3*SD,20),LLV(L+AVTR+3*SD,20));Val3:=If(Pk>0,HHV(H-AVTR-2*SD,20),LLV(L+AVTR+2*SD,20));Val2:=If(Pk>0,HHV(H-AVTR-SD,20),LLV(L+AVTR+SD,20));Val1:=If(Pk>0,HHV(H-AVTR,20),LLV(L+AVTR,20));

    Val4;Val3;Val2;Val1;

    WOLF WAVE PATTERNS

    Here's a simple Metastock exploration for locating Wolf Wave patterns. It doesn't hitall that often, but when it does, it's best to pay attention.ColA: WWPa:=Trough(4,LOW,5);Pb:=Peak(3,HIGH,5);

    P1:=Trough(3,LOW,5);P2:=Peak(2,HIGH,5);

  • 8/6/2019 Formule - Metastock

    37/554

    37

    P3:=Trough(2,LOW,5);P4:=Peak(1,HIGH,5);P5:=Trough(1,LOW,5);tb:=TroughBars(1,LOW,5);tb pa ANDpb < p2 ANDp1 < p2 ANDp1 < p4 ANDp1 > p3 ANDp3 > p5 ANDp4 < p2 AND

    ColB: Tangents

    p1:=Trough(3,LOW,5);

    p3:=Trough(2,LOW,5);p5:=Trough(1,LOW,5);o1:=p1-p3;o2:=p1-p5;a1:=TroughBars(3,LOW,5)-TroughBars(2,LOW,5);a2:=TroughBars(3,LOW,5)-TroughBars(1,LOW,5);tan1:=o1/a1;tan2:=o2/a2;Abs(tan1-tan2)

    Filter:colA AND colB

  • 8/6/2019 Formule - Metastock

    38/554

    38

    ROC(V,1,$) > 0After you have entered the four Highlights, click OK to finish editing the expert'sproperties. You can now right-click on the heading or background of any chart. Next,select Expert Advisor and then Attach from the Chart shortcut menu. Attach themarket facilitation index expert, and it will highlight the four market facilitation

    patterns that were discussed in Hartle's article. Note: You can save a chart as atemplate with this expert attached, and then any time you apply the template to achart, the market facilitation index expert will automatically attach to the chart.

    from Allan J. McNichol, EQUIS Internationalwww.equis.com Sender: [email protected]

    TRUE STRENGTH INDEX

    Walter Lake [email protected]

    True Strength Index = TSITSI(close,r,s) = 100*EMA(EMA(mtm,r),s / EMA(EMA(ImtmI,r),s)Numeratormtm = one-day momentum of closer-day EMA of mtm {25 day}s-day EMA {13 day double smoothing}DemoninatorImtmI = absolute value of mtmr-day EMA of ImtmIs-day EMA {double smoothing}

    TSI(close,25,13)Signal Line = EMA(TSI,7)thresholds at +25, 0, -25- 0 -5 day EMA of 20 day EMA of 1 day momentum {little lag Vs smoothing of price}- 0 -Ergodic Oscillator = Ergodic + Signal line {TSI version of Slow Stochastic}Erodic(close,r) = TSI(close,r,5) {double smoothing is fixed at 5}Signal Line(close,r) = EMA(TSI(close,r,5),5)r = 20daysthresholds are +20, -20

    interesting comparision chart between 20 Slow Stochastic and 20 Erodic {more headroom in oversold-bought areas}another chart showing Ergodic Osc = TSI(close,32,5) with 5-day EMA signal line0

    Trading Ergodics with the Trend - Rules1. Enter or hold position only when slope of Erogodic Signal line has thesame direction as the trend2. Stand aside when slope of Erogodic Signal Line is in the oppositediretion of trend3. Enter or exit position when Erogodic and its Signal Line cross

    - 0 -Slow TSI Trend = TSI(close,64,64) {? weekly looking chart - very little lag}

  • 8/6/2019 Formule - Metastock

    39/554

    39

    Thresholds set at +15 & -15Trading Ergodics with Slow TSI Trend1st window - Slow TSI Trend = TSI(close,64,64)2nd window - Ergodic Osc = TSI(close,64,5)

    {Fibonacci Trader-Dynamic Balance Point Step}

    DPS:=(ValueWhen(1,FmlVar("FT-DBP","DBC"),FmlVar("FT-DBP","DBC"))+ValueWhen(5,FmlVar("FT-DBP","DBC"),FmlVar("FT-DBP","DBC"))+ValueWhen(10,FmlVar("FT-DBP","DBC"),FmlVar("FT-DBP","DBC"))+ValueWhen(15,FmlVar("FT-DBP","DBC"),FmlVar("FT-DBP","DBC"))+

    ValueWhen(20,FmlVar("FT-DBP","DBC"),FmlVar("FT-DBP","DBC")))/5;DPS;

    {created by Adam Hefner 9-1-99}EXAMPLE OF HOW TO CREATE A MACD Crossover SYSTEM TEST INMetaStock

    Enter Long:Mov(C,5,E) > Mov(C,13,E)AND Mov(C,13,E) > Mov(C,40,E)

    Close Long:Cross(Mov(C,13,E),Mov(C,5,E))

    Now you can play with these combinations on both the enter long and close long side.For example,keep the same Enter Long but change the Close Long to =

    Cross(Mov(C,40,E) ,Mov(C,5,E) )

    This will keep you in the trade longer. You may want to enter when the 5 crossesabove the 13 and not wait for the 40 OR, you may just want to use the 5 cross abovethe 40 and forget about the 13.

    (created by David Evans)

    Trending BandiniMov(C,2,S)>Mov(Mov(C,2,S),2,S) ANDMov(Mov(C,2,S),2,S)>

    Mov(Mov(Mov(C,2,S),2,S),2,S) ANDMov(Mov(Mov(C,2,S),2,S),2,S)>

  • 8/6/2019 Formule - Metastock

    40/554

    40

    Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S) ANDMov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S)>Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S) ANDMov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S)>

    Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S) ANDMov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S)>Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S) ANDMov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S)>Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S)ANDMov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S)>Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S) ANDMov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S)>

    Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,S)

    {created by Brookelise}

    Elliot Oscillator

    Mov((H+L)/2,5,S)-Mov((H+L)/2,34,S)GRIIThis is a long formula so I broke it up into four pieces. GRII is derived from formulas1, 2, and 3.

    This is a nifty momentum oscillator that I've used for about five years to help medetermine the direction of a given market when I have evidence that the market isabout to turn.

    testformula1 GRIIF1 tsf(C,9)-ref(tsf(C,9),-1)

    2 GRIIF2 (ref(tsf(C,9),-1)-(ref(tsf(C,9),-2)))

    3 GRIIF3 (ref(tsf(C,9),-2)-(ref(tsf(C,9),-3)))

    4 GRII (tsf(C,9)-ref(tsf(C,9),-1))+((ref(tsf(C,9),-1)-ref(tsf(C,9),-2)))+((ref(tsf (C,9),-2)-(ref(tsf(C,9),-3))))

    (written by Eddie Kwong)

    SPECIAL TRIX

    This is my own version of the well-known indicator, TRIX. I have had much better

    results with this than the canned version that comes with every charting program.

  • 8/6/2019 Formule - Metastock

    41/554

    41

    trix(12)-ref((trix(12)),-1)

    (created by Eddie Kwong){Fibonacci Trader - Fixed Balance Point}

    {NOTE: under Color/Style options, changeplot to last "style" option}

    {Fixed Balance Point Calculation}FBC:=If(DayOfWeek()=1 AND Ref(DayOfWeek(),-1)0,FBC);FBP

    {created by Adam Hefner}

    GANNSWINGHILOWACTIVATOR

    I was only able to implement Krausz's Gann Swing HiLow Activator in Metastock,because it's simply the average of the last three bars High (stop for short position orlong entry) or Low (stop for long position or short entry) plotted one period forward:Ref(Mov(L,3,S),-1) or Ref(Mov(H,3,S),-1)(from Thorsten Buhmann in Germany)Tema PV Binary WaveUse of Tema PV Binary Wave and Tema QStick Formulas in MetaStock, from

    "JimG"There are really two different ways to use these formulas. Since the Binary Wave is asmoothed addition of several technical indicators that each give +1 when bullish, 0when neutral and -1 when negative, it makes sense that a positive number is bullishand rising numbers are bullish. Similarly negative numbers and falling numbers arebearish.The QStick is really a candlestick type indicator, but can be read as bullish or bearishin same way as the Binary Wave.The two traditional ways to play them are to buy on a rise from a negative peak andsell on a fall from a positive peak, or to buy on a zero cross over to the upside and sellon a zero crossover to the downside. Of course you can optimize and find various buy

    and sell levels as long as you understand what is bearish and what is bullish.

  • 8/6/2019 Formule - Metastock

    42/554

    42

    My own MetaStock system tests alerts on the BW crossing a moving average of itselfand buys or sells on a confirmation of Qstick turning positive or negative respectively.Having said that, I don't make my buy an sell decisions from the indicators or thesystem test. I do use the system test as an initial screen and use a buy signal as a flagto move the stock to my watch list. I make all buying and selling decisions based on

    the trend channels. Over the years, I've found that works best for me.

    RUGGERIO'S TREND

    Ruggiero's rules for trend mode quoting his table 4.9:

    1. If ADX crosses above 25, then the market is trending.2. If ADX crosses below 20, then the market is consolidating.3. If ADX crosses below 45 from above, then the market is consolidating.4. If ADX rises from below 10 on 3 out of 4 days, then the market will startto trend.5. If a trend is based on rule 4, it remains in effect until the 5 daydifference in ADX is less than 0.

    Ruggiero employs a 14 day ADX but that is based on T-Bonds data. He suggestsemploying the above rules as a filter. I make the indicator take the value +1 iftrending, a -1 if consolidating according to the above criteria but I guess the zero isfor the grey areain between. Anyway according to definition: If a market is not trending it must beconsolidating. However the zero may contain additional useful information. Ruggierosuggests tweaking the threshold values.

    periods:=Input("Periods?",1,63,14);If((ADX(periods)>25 AND (BarsSince(Cross(45,ADX(periods))) >BarsSince(Cross(ADX(periods),25)))) OR (ADX(periods) > 10 ANDRef(ADX(periods),-4)0)), 1,If(ADX(periods)

  • 8/6/2019 Formule - Metastock

    43/554

    43

    www.techanalysis.comThose who know me have found out I vacillate between the VERY complicated andthe very simple. I have been following a few stocks (medium volatility, but good %%moves both up and down over a 2-5 week time frame) and tracking them with about15 templates on which most of the formulas that I have acquired reside. I wanted to

    track those that did best and those that were not as effective. I also tracked thoseformulas that were late in showing turns in momentum vs those that caught the turnclose on. In this regard, I was looking for finding stocks at intermediate term lows andhighs, NOT for indicators that identified stocks that had begun their run in anydirection and were destined to continue. As a result, I came up with a very simpleindicator that showed a HIGH degree of accuracy in "turn-calling", but it did NOTgive me indication of the strength or duration of the new move, only that it probablywould occur. I believe that I have finally discovered that any signal of a change inmomentum will NEVER give you a sense of strength or duration BY ITS VERYNATURE, and that only signals that identify stocks WITHIN a momentum trend(ie..already established) are able to do that. My momentum trend change indicator is

    derived from an intermediate trend indicator I've used for some time in MSWIN 6.0...PDI(34) - MDI(34)My new formula is...........((PDI(8) - MDI(8)) - (PDI(21) - MDI(21))) + (PDI(13) - MDI(13))Try it......I think you'll like it......and it's the same coding in WOW, I believe..........BWChanI have posted an update to the RMTA and TOSC formula's,>the first formulas had an "Absolute Value" that wasn't called for>in the article ( I had mistaken the "[" "]" to mean "|" "|"). The new>formulas seem to plot exactly as the old......but I wanted the code>to match the math in the article.>Thanks go out to William Golson for the help.>>{Recursive Moving Trend Average}>Lb:=Input("Look-Back Period?",3,100,21);>Alpha:=2/(LB+1);>Bot:=(1-Alpha)*(If(Cum(1)RMTA:=(1-Alpha)*(If(Cum(1) (Alpha*(C+Bot-Ref(Bot,-1)));>RMTA;>

    >{TOSC}>Lb:=Input("Look-Back Period?",3,100,21);>Alpha:=2/(LB+1);>Bot:=(1-Alpha)*(If(Cum(1)RMTA:=(1-Alpha)*(If(Cum(1) (Alpha*(C+Bot-Ref(Bot,-1)));>TOSC:=RMTA-Mov(C,lb,E);>TOSC;> Best wishes,> Adam Hefner.e-mail: [email protected]

  • 8/6/2019 Formule - Metastock

    44/554

    44

    THERECURSIVEMOVING TRENDAVERAGE

    Is the name of an article in the December issue of TASC, written by>Dennis Meyers. In it he describes what he calls " The Recursive>Moving Trend Average" . I wont go into all the article right now, but

    >here is my translation of his math (for Metastock 6.5) :>> {Recursive Moving Trend Average}>Lb:=Input("Look-Back Period?",3,100,21);>Alpha:=2/(LB+1);>Bot:=(1-Alpha)*(If(Cum(1)RMTA:=(1-Alpha)*(If(Cum(1) (Alpha*Abs(C+Bot-Ref(Bot,-1)));>RMTA;>>He then explains how to make an oscillator by subtracting an>Exponential MA form the Recursive MA...... again here is the code:>> {TOSC}>Lb:=Input("Look-Back Period?",3,100,21);>Alpha:=2/(LB+1);>Bot:=(1-Alpha)*(If(Cum(1)RMTA:=(1-Alpha)*(If(Cum(1) (Alpha*Abs(C+Bot-Ref(Bot,-1)));>TOSC:=RMTA-Mov(C,lb,E);>TOSC;

    >>>Here is the code for System Testing;>>Buy Long:>>Lb:=opt1;>ent:=3;>Alpha:=2/(LB+1);>Bot:=(1-Alpha)*(If(Cum(1)RMTA:=(1-Alpha)*(If(Cum(1) (Alpha*Abs(C+Bot-Ref(Bot,-1)));>TOSC:=RMTA-Mov(C,lb,E);>Cross(tosc,(0-Abs(ent)))>>Sell short:>>Lb:=opt1;>ent:=3;>Alpha:=2/(LB+1);>Bot:=(1-Alpha)*(If(Cum(1)RMTA:=(1-Alpha)*(If(Cum(1) (Alpha*Abs(C+Bot-Ref(Bot,-1)));>TOSC:=RMTA-Mov(C,lb,E);

  • 8/6/2019 Formule - Metastock

    45/554

    45

    >Cross((0+Abs(ent)),tosc1)>>Opt1 is the look- back periods, of 3 to 30, and>Opt2 is the entry value of the oscillator, 0 to 5.>

    >Now, after all the hours spent on figuring out the>code, I have discovered that the RMTA plots verysimilar to the DEMA, oh well............> Adam Hefner.> e-mail: [email protected]

    Market Pressure - Ultimate:

    This is the basic calculation:If toadies close is greater than yesterdays close and

    toadies volume is greater than yesterdays volume, write down toadies volume * close,otherwise,If toadies close is less than yesterdays close andtoadies volume is less than yesterdays volume, write down todays volume as anegative number * close, otherwise write down 0.

    Then add up the past 7 days and * 4, add this tothe past 14 days total and * 2, add this tothe past 28 days total.Plot this grand total in your chart for each new trading day.

    Simple Interpretation:Market Pressure - Ultimate can show divergences with the instrument it is plottedagainst.It may show signs of support and resistance when the indicator hits areas ofsupport/resistance on its own graph.Comparing rates of change/moving averages of the indicator against that of theinstrument may reveal accumulation/distribution pressures.

    Market Pressure - Ultimate:

    Sum(If(C > Ref(C,-1)AND V > Ref(V,-1),V * C,If(C < Ref(C,-1)AND V < Ref(V,-1),Neg(V) * C,0)),7) * 4 +

    Sum(If(C > Ref(C,-1)AND V > Ref(V,-1),V * C,If(C < Ref(C,-1)

    AND V < Ref(V,-1),Neg(V) * C,0)),14) * 2 +

  • 8/6/2019 Formule - Metastock

    46/554

    46

    Sum(If(C > Ref(C,-1)AND V > Ref(V,-1),V * C,

    If(C < Ref(C,-1)AND V < Ref(V,-1),Neg(V) * C,0)),28)

    Changing Ways Accumulation/Distribution:

    This is the calculation for the first formula (Todays Change):Todays close - yesterdays close

    This is the main formula, incorporating the first calculation:

    If todays change (1st formula) is greater than a 7 day exponential moving average oftodays change and todays close is greater than yesterdays close, write down todaysclose + todays vo