#MAX_QUOTES 200 #OUTPUT_FILE 'SELECT.LST' { Technical Analysis Scanner (TAS) -------------------------------- TAS is a product of Martin Moore ----------------------------------------------------------------- TAS Script Language (TASSL) is similar to PASCAL syntax. TAS has built-in TA functions and price arrays so that TASSL scripts can be created by the user to screen a Metastock(*) Data Directory (or directories) for stocks which match custom criteria. The rest of this file gives an example of a TASSL script. This entire file is the input for the TAS program. (*) Metastock is a trademark of Equis International, Inc. ----------------------------------------------------------------- A few notes about syntax: ------------------------- } {comment} {- curly braces surround comments a := b - ':=' is used to assign 'b' to 'a' * / - + - multiply, divide, subtract, add ( expression) - parentheses are used to guarantee order of evaluation is correct IF (x) THEN - Conditions are tested with IF (cond) THEN true tstmt; statement is executed. If (cond) is false, then ELSE the ELSE (if present) portion is executed fstmt; Predefined Values : Filled in when each MSP file is processed -------------------------------------------------------------- TICKER - The 'ticker' symbol, e.g., AXP FULLNAME - The 'full name', e.g., AMERICAN EXPRESS O - The OPEN "data array" H - The HIGH "data array" L - The LOW "data array" C - The CLOSE "data array" V - The VOLUME "data array" OI - The OPEN INTEREST "data array" S A M P L E T A S S L S C R I P T --------------------- SELECT.scr --------------------------- This TASSL script contains the "Binary Wave" calculation shown in the Metastock(*) 2.0 distribution system. It has been modified to include the following indicators as well: BUY SELL Chaikin's Oscillator > 0 < 0 Commodity Channel Index > 100 < -100 It is here to give an example of the kind of analysis available with the TASSL language. The Metastock manual discusses this binary wave system on page 187 of the User's Manual. The script will put out a message if the value of the binary wave changes from yesterday to today (the terms 'today' and 'yesterday' are used loosely, but meant to be the 'latest day' and the 'day before', respectively). Two variables are defined and updated as each of the four individual binary wave formulas are checked. They are: "t_bwave" which is today's binary wave value (-6 to +6) and "y_bwave" which is yesterday's binary wave value (-6 to +6) What we are looking for is a TRANSITION from yesterday to today. If the stock moved to +6 today and it was lower yesterday, perhaps this is a buying opportunity. If the stock moved to -6 perhaps it is a short sell. } MACD_ARRAY : ARRAY; { Place to put values for TODAY } MACDTRIG_ARRAY : ARRAY; y_bwave := 0; { this is our 'score' yesterday} t_bwave := 0; { this is our 'score' today} { First compute MACD Binary Wave for yesterday and today Note that MACD() computes the 12 day EMA - 26 day EMA and places the result in the array MACD_ARRAY. The 9 day EMA is computed and placed in the result array MACDTRIG_ARRAY } MACD_ARRAY = MACD(); MACDTRIG_ARRAY = MACDTRIGGER(); IF MACD_ARRAY[0] > MACDTRIG_ARRAY[0] THEN t_bwave := t_bwave + 1; { macd greater than trigger } else t_bwave := t_bwave - 1; { macd less than trigger } if MACD_ARRAY[-1] > MACDTRIG_ARRAY[-1] then y_bwave := y_bwave + 1; { macd greater than trigger } else y_bwave := y_bwave - 1; { macd less than trigger } { Now compute 20-MA B-Wave } MA20 : ARRAY; MA20 := mov(c,20,'E'); { Compute 20 unit EMA of close } if c[0] > MA20 then { compare today's close to today's ema} t_bwave := t_bwave + 1; { ema greater than close } else t_bwave := t_bwave - 1; { ema less than close } if c[-1] > MA20[-1] then { compare yesterday's close to today's ema} y_bwave := y_bwave + 1; { ema greater than close } else y_bwave := y_bwave - 1; { ema less than close } { Now compute 12-ROC B-Wave } ROC12 : ARRAY; { PLACE TO PUT RATE OF CHANGE } ROC12 := roc(c,12,'%'); if ROC12 > 0 then t_bwave := t_bwave + 1; { roc greater than 0 } else t_bwave := t_bwave - 1; { roc less than 0 } if ROC12[-1] > 0 then y_bwave := y_bwave + 1; { roc greater than 0 } else y_bwave := y_bwave - 1; { roc less than 0 } { Now compute 5-3 stochastic B-wave } STOCH53 : ARRAY; { PLACE TO PUT STOCH(5,3) VALUES } STOCH53 := stoch(5,3); { compute stoch(%K period, %K slow) } if STOCH53[0] > 50 then t_bwave := t_bwave + 1; { stoch greater than 50 } else t_bwave := t_bwave - 1; { stoch less than 50 } if STOCH53[-1] > 50 then y_bwave := y_bwave + 1; { stoch greater than 50 } else y_bwave := y_bwave - 1; { stoch less than 50 } { check if Chaikin's AD oscillator is above or below 0 } CO_ARRAY : ARRAY; CO_ARRAY := CO(); { PLACE CHAIKIN'S OSCILLATOR IN CO_ARRAY} IF CO_ARRAY[0] > 0 THEN t_bwave := t_bwave + 1; else t_bwave := t_bwave - 1; IF CO_ARRAY[-1] > 0 THEN y_bwave := y_bwave + 1; else y_bwave := y_bwave - 1; { check if CCI(14) above +100 or below -100 } CCI14 : ARRAY; { PLACE TO PUT CCI(14) VALUES } CCI14 := cci(14); if CCI14[0] < -100 then t_bwave := t_bwave - 1; else if CCI14[0] > 100 then t_bwave := t_bwave + 1; if CCI14[-1] < -100 then y_bwave := y_bwave - 1; else if CCI14[-1] > 100 then y_bwave := y_bwave + 1; { Okay, here we are at the end of the script. We have boiled the six formulas down to two values: "t_bwave" which is today's binary wave value (-6 to +6) and "y_bwave" which is yesterday's binary wave value (-6 to +6) } { First, let's check if the wave moved to +6..if so, let's print out it's value then and now } y_bwave := INT(y_bwave); { make y_bwave into an INTEGER } t_bwave := INT(t_bwave); { make t_bwave into an INTEGER } if FIRST_TICKER then begin writeln(' \t \t\t\t \tPRIOR\tCURRENT '); writeln(' \t \t\t\t\tBINARY\t BINARY '); writeln('TICKER\t\tFULLNAME\t\t\t WAVE\t WAVE CHANGE ALERT'); end; write(TICKER,'\t',fullname,'\t'); diff := INT(t_bwave-y_bwave); write(y_bwave,' ',t_bwave,' ',diff); if ((y_bwave < 6) and (t_bwave = 6)) then writeln(' **BUY**') { Now, let's check if the wave moved to -6..if so, let's print out it's value then and now } else if ((y_bwave > -6) and (t_bwave = -6)) then writeln(' **SELL**') else begin writeln(' '); end; {-----------------END OF SELECT.TAS TASSL SCRIPT------------------}