| Metastock 
              Formulas 
              - EClick 
              here to go back to Metastock Formula 
              Index
              
                 
                  |  IMPORTANT: 
                      These formulas aren't my complete collection. For my complete 
                      collection of instantly usable, profitable 
                      and powerful MetaStock formulas Click 
                      Here
 |  Would 
            You Like To Use MetaStock To Its Full Potential? Discover the Amazingly 
            Simple Secret to Master Metastock Step-By-Step 
            - click 
            here
 
 
 A | A 1 | B | B 1 | C | C 1 | D | D 1 | E | F | G | H | I | J | K | L | M | M 1 | N | O | P | R | S | S             1 | T | U | V | W | Z |
 
 
 
 
              
                 
                  | The 
                      Robert Krauz article I read described the ECO as "a double 
                      smoothed ratio of the difference between the close(C) and 
                      open(O) of each bar, and the difference between the high(H) 
                      and low(L) prices for each bar" originally created by William 
                      Blau.
 FWI my interpretation is:
 
 {ECO[Ergodic Candlestick Oscillator]}
 (MOV(MOV(C-O,5,E))26,E)/MOV(MOV(H-L,5,E))26,E))*100
 (Go 
                      Top) |   
                  | Mov((H+L)/2,5,S)-Mov((H+L)/2,34,S) (Go 
                      Top) |   
                  | Mov(C,5,S)-Mov(C,35,S) 
                      
 {from Jan Robert Wolansky}
 
 {TIMESERIES TRIX - by Joe Luisi}
 
 {published in S&C - TASC article "Playing Trix" by Joe 
                      Luisi (June 1997) and
 to be used on weekly data}
 
 CLA:=TRIX(3);
 CLB:=Ref(TRIX(3),-1);
 CLC:=Mov(TRIX(3),8,TIMESERIES);
 CLD:=Ref(Mov(TRIX(3),8,TIMESERIES),-1);
 SHORT:=When(CLA,>,CLC) AND When(CLB,<,CLD) AND
 When(CLA,<,0)AND When(CLA,>,-2);
 LONG:=When(CLA,<,CLC) AND When(CLB,>,CLD) AND
 When(CLA,>,0)AND When(CLA,<,+2);
 If(LONG>0,+1,
 If(SHORT>0,-1,PREVIOUS))
 (Go 
                      Top) |   
                  | As 
                      far as using MetaStock for identifying waves, use a 5/34 
                      histogram forfinding wave 4, the end of wave 3 and for help with identifying 
                      wave 1/2,
 which apparently Advanced Get uses extensively. You can 
                      write MetaStock
 explorations/templates/experts, etc., with this indicator; 
                      e.g.,
 explorations to find the peaks and troughs of the 5/34 histogram.
 
 The version of the indicator I use in MetaStock v6.52 is:
 
 Mov(OscP(5,34,E,$),5,S)
 
 -150 days minimum of data.
 
 The peaks of the histogram help identify waves 1, 3 and 
                      5 and troughs for
 waves 2 and 4. Use MetaStock line studies (both trendlines, 
                      channels and
 fib retracements) for additional wave identification/analysis. 
                      Of course,
 you can label the waves with the text box.
 (Go 
                      Top) |   
                  | avoid 
                      using when the market has no clear direction -- enter long
 mov(c,5,e)>mov(c,21,e) and
 ref(mov(c,5,e),-1)<=ref(mov(c,21,e),-1)
 exit long
 mov(c,5,e)<mov(c,21,e) and
 ref(mov(c,5,e),-1)>=ref(mov(c,21,e),-1)
 (Go 
                      Top) |   
                  | {The 
                      End Point Moving Average was introduced in the October 95 
                      issue ofTechnical Analysis of Stocks & Commodities in the article 
                      "The End Point
 Moving Average", by Patrick E. Lafferty. The exact formula 
                      for the End Point
 Moving average is as follows:}
 
 ( 14 * Sum( Cum( 1 ) * C,14 ) - Sum( Cum( 1 ),14) * Sum( 
                      C,14) ) / (14
 * Sum( Pwr( Cum( 1 ),2),14 ) - Pwr( Sum( Cum( 1 ),14 ),2 
                      ) ) * Cum( 1 )
 + (Mov(C,14,S) - Mov( Cum( 1 ),14,S) * (14 * Sum( Cum( 1 
                      ) * C,14) -
 Sum( Cum( 1 ),14 ) * Sum( C,14) ) / (14 * Sum( Pwr( Cum( 
                      1 ),2 ),14) -
 Pwr( Sum( Cum( 1 ),14 ),2 ) ) )
 
 {The above formula plots the last value of a linear regression 
                      line of the
 previous 14 periods. The Time Series Forecast (TSF) takes 
                      this value and the
 slope of the regression line to forecast the next day and 
                      then plots this
 forecasted price as today's value. from Equis.}
 (Go 
                      Top) |   
                  | I 
                      am trying to use the MetaStock Explorer to find all stocks 
                      with the following:
 1. c - mov(c,60,s)<0
 2. Above condition should be in place for 20 days/
 
 I use c - Mov(c,60,s)<0 but how do I write the Exploration?
 
 from wsb
 
 
 Use (C - Mov(C,60,S))<0 AND Ref((C - Mov(C,60,S))<0),-1) 
                      AND ... Ref((C -Mov(C,60,S))<0),-19)
 
 where ... stands for all Ref( x,-i) with i between 2 and 
                      18.
 (Go 
                      Top) |   
                  | Wilders(TR,periods) 
                      = Mov(TR,2*periods-1,E) (Go 
                      Top) |   
                  | This 
                      is the calculation:
 Take todays volume * 50 and find the square root of that 
                      number. Then divide 2.5 by your result. Then take the result 
                      of dividing by 2.5 and * todays close. Write this figure 
                      down.
 Then plot a 10 day moving average of this figure. This is 
                      the fundamental calculation which we shall call a.
 
 Take the value for a and take it away from the lowest value 
                      of itself over the past 5 days. Add up these results for 
                      the past 3 days. This number is called b.
 
 Now take the highest value for a over the past 5 days and 
                      subtract the lowest value for a, also over the past 5 days. 
                      Call this number c.
 
 Finally, divide b by c and multiply the answer by 100. (phew!)
 
 Simple Interpretation:
 Excel Confidence % should oscillate between 0 and 100, usually 
                      at the extreme ends of the scale. A value of 0 indicates 
                      no confidence in the market going up, whilst 100 indicates 
                      perfect confidence in the market going up. Although this 
                      obviously isn't the holy grail of indicators, it does offer 
                      some insight into what the market is thinking and how one 
                      can measure investor sentiment.
 You might like to add a slower version of this (just increase 
                      the 3 day and 5 day calculations to something you believe 
                      to be appropriate - try 7 & 15) and trade the crossovers, 
                      as with stochastics.
 You can also just trade the values ie 90 or higher, buy, 
                      10 or lower, sell.
 
 Metastock code for Excel Confidence %:
 
 (Sum(
 Mov(C * (2.5/ Sqrt(50 * V)),10,S)-
 LLV(Mov(C * (2.5/ Sqrt(50 * V)),10,S),5), 3 ) /
 Sum(
 HHV(Mov(C * (2.5/ Sqrt(50 * V)),10,S),5) -
 LLV(Mov(C * (2.5/ Sqrt(50 * V)),10,S),5), 3) ) * 100
 (Go 
                      Top) |   
                  | A:=CloseB:{Breakout}(H-L)>ATR(9)
 C:{Signal}Ref(C,-2)<=Mov(C,50,S) and
 Ref(C,-1)>Mov(C,50,S) OR Ref(C,-1)<=Mov(C,50,S) and
 C>Mov(C,50,S)
 D:{entry}HHV(H,2)+.125
 E:{Stop}If(Ref(C,-2)<=Mov(C,50,S) and
 Ref(C,-1)>Mov(C,50,S),Ref(C,-1)-1,If(Ref(C,-1)<=Mov(C,50,S)
 and C>Mov(C,50,S),C-1,0))
 Filter:ColB and ColC
 (Go 
                      Top) |   
                  | A:=CloseB:{Breakout}(H-L)>ATR(9)
 C:{Signal}Ref(C,-2)>=Mov(C,50,S) and
 Ref(C,-1)<Mov(C,50,S) OR Ref(C,-1)>=Mov(C,50,S) and
 C<Mov(C,50,S)
 D:{entry}LLV(L,2)-.125
 E:{Stop}If(Ref(C,-2)>=Mov(C,50,S) and
 Ref(C,-1)<Mov(C,50,S),Ref(C,-1)-1,If(Ref(C,-1)>=Mov(C,50,S)
 and C<Mov(C,50,S),C-1,0))
 Filter:ColB and ColC
 (Go 
                      Top) |   
                  | A 
                      trading system based on work of Bill Williams
 Enter Long:
 Cross(C,Fml("chaos green bl")) AND Fml("chaos green bl") 
                      > Fml("chaos blue bl")
 Close Long:
 Cross(Fml("chaos green bl"),C) AND Fml("chaos blue bl") 
                      > Fml("chaos green bl")
 
 I tested this on several different stocks and it shows potential. 
                      I really
 haven't spent too much time on it yet so I'm not yet sure 
                      of the
 significance of the other indicators. The above was just 
                      what I could throw together based upon what my eyes on the 
                      chart with the indicators showed me.
 (Go 
                      Top) |   
                  | In 
                      MetaStock 5.x for Windows there is a way to plot the end 
                      points of a linear regression linewith channels +/- 2 Standard 
                      Deviations.
 Here 
                      are the three formulas:  *Linear 
                      Regression (14):(14 * Sum(Cum(1) * C,14) - Sum(Cum(1),14)* Sum(C,14)) 
                      /(14 * Sum(Pwr(Cum(1),2),14)
 - Pwr(Sum(Cum(1),14),2)) * 
                      Cum(1) + (Mov(C,14,S) - Mov(Cum(1),14,S) * (14 *
 Sum(Cum(1) 
                      * C,14) - Sum(Cum(1),14) * Sum(C,14))/(14 * Sum(Pwr(Cum(1),2),14)
 - Pwr(Sum(Cum(1),14),2)))
 *Linear 
                      Regression Lower Band:Fml( "*Linear Regression (14)" ) - 2* Stdev( Fml( "*Linear 
                      Regression (14)" ) ,14)
 *Linear 
                      Regression Upper:Fml( "*Linear Regression (14)" ) + 2* Stdev( Fml( "*Linear 
                      Regression (14)" ) ,14)
 (Go 
                      Top) |   
                  | { 
                      Exponential Moving Average v2.2 }{ EMA periodicity shortens 
                      on low bar count }{ ©Copyright 2003-2004 Jose Silva 
                      }{ [email protected] }
 
 pds:=Input("EMA periods",1,2520,21);
 x:=Input("use Open=1 High=2 Low=3 Close=4 WClose=5 
                      P=6",1,6,4);
 shift:=Input("EMA vertical shift %", -100,100,0)/100+1;
 plot:=Input("[1]EMA,  [2]Crossover signals", 1,2,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,P,C)))));
 pds:=If(pds>Cum(IsDefined(x)), Cum(IsDefined(x)),pds);
 Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 Ema:=Ema*shift;
 signals:=Cross(x,Ema)-Cross(Ema,x);
 
 If(plot=2,signals,Ema)
 (Go 
                      Top) |   
                  | { 
                      ATR volatility-adjusted, dyn-period EMA v2.1 }
 { Positive sensitivity:  EMA periodicity shortens on 
                      high ATR volatility - increases on low ATR volatility 
                      }
 { Negative sensitivity:  EMA periodicity shortens on 
                      low ATR volatility - increases on high ATR volatility }
 
 { [1]EMA:         
                      ATR volatility-adjusted EMA }
 { [2]Dyn periods: EMA periodicity used }
 { [3]ATR vlty:    ATR volatility 0~100% }
 { [4]Signals:     EMA/price crossover 
                      signals }
 
 { ©Copyright 2004 Jose Silva }{ [email protected] 
                      }
 
 pds:=Input("EMA avg periods",1,2520,21);
 sens:=Input("ATR volatility sensitivity (+100 to -100)%",-100,100,100)/100;
 pdsVlty:=Input("ATR volatility sampling periods",2,2520,126);
 pdsATR:=Input("ATR periods",1,2520,10);
 x:=Input("[1]Open  [2]High  [3]Low  
                      [4]Close  [5]Vol  [6]P",1,6,4);
 plot:=Input("[1]EMA,  [2]Dyn periods,  [3]ATR 
                      vlty,  [4]Signals",1,4,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 ATRvlty:=(ATR(pdsATR)-LLV(ATR(pdsATR),pdsVlty)) /(HHV(ATR(pdsATR),pdsVlty)-
 LLV(ATR(pdsATR),pdsVlty)+.000001);
 multi:=If(ATRvlty<=.5,10*Power(ATRvlty,3.4739)+.1,10*Power(ATRvlty,3.32)
 +.000001);
 multi:=If(sens>0,1/multi,multi);
 multi:=If(multi<1,1-(1-multi)*Abs(sens),(multi-1)*Abs(sens)+1);
 pds:=pds*multi;
 pds:=If(pds>Cum(IsDefined(x))-(pdsVlty+pdsATR),Cum(IsDefined(x))-(pdsVlty+pdsATR),pds);
 pds:=If(pds<1,1,pds);
 ATREma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 signals:=Cross(x,ATREma)-Cross(ATREma,x);
 
 If(plot=2,pds,If(plot=3,ATRvlty*100,
 If(plot=4,signals,ATREma)))
 (Go 
                      Top) |   
                  | { 
                      Bollinger Band volatility-adjusted, dynamic-period EMA v1.1 
                      }
 { Positive sensitivity: EMA periodicity shortens on 
                      high BB volatility - increases on low BB volatility }
 { Negative sensitivity: EMA periodicity shortens on 
                      low BB volatility - increases on high BB volatility 
                      }
 
 { [1]EMA:         
                      BB volatility-adjusted EMA }
 { [2]Dyn periods: EMA periodicity used }
 { [3]BB vlty:     BB volatility 0~100% 
                      }
 { [4]Signals:     EMA/price crossover 
                      signals }
 
 { ©Copyright 2004 Jose Silva }{ http://users.bigpond.com/prominex/pegasus.htm 
                      }
 
 pds:=Input("EMA avg periods",1,2520,21);
 sens:=Input("BB volatility sensitivity (+100 to -100)%",-100,100,75)/100;
 pdsVlty:=Input("BB volatility sampling periods",2,2520,126);
 pdsBB:=Input("Bollinger Band periods",2,2520,10);
 x:=Input("[1]Open  [2]High  [3]Low  
                      [4]Close  [5]Vol  [6]P",1,6,4);
 plot:=Input("[1]EMA,  [2]Dyn periods,  [3]BB 
                      vlty,  [4]Signals",1,4,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 y:=(BBandTop(x,pdsBB,S,2)-BBandBot(x,pdsBB,S,2))/Mov(x,pdsBB,S);
 BBvlty:=(y-LLV(y,pdsVlty))/(HHV(y,pdsVlty)-LLV(y,pdsVlty)+.000001);
 multi:=If(BBvlty<=.5,10*Power(BBvlty,3.4739)+.1,10*Power(BBvlty,3.32)+.000001);
 multi:=If(sens>0,1/multi,multi);
 multi:=If(multi<1,1-(1-multi)*Abs(sens),(multi-1)*Abs(sens)+1);
 pds:=pds*multi;
 pds:=If(pds>Cum(IsDefined(x))-(pdsVlty+pdsBB),Cum(IsDefined(x))-(pdsVlty+pdsBB),pds);
 pds:=If(pds<1,1,pds);
 BBema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 signals:=Cross(x,BBema)-Cross(BBema,x);
 
 If(plot=2,pds,If(plot=3,BBvlty*100,If(plot=4,signals,BBema)))
 (Go 
                      Top) |   
                  | { 
                      Cycle-adaptive Exponential Moving Avg v1.1 }{ EMA periodicity 
                      determined by historical price cycle based on ZigZag cycles 
                      }{ ©Copyright 2004 Jose Silva }{ [email protected] 
                      }
 pr:=Input("ZigZag cycle reversal %",0,100,5);
 choose:=Input("EMA periods based on:  [1]Cycle,  
                      [2]Cycle Avg",1,2,1);
 multi:=Input("EMA periodicity:  Cycle/Avg length 
                      x",.1,100,2);
 x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 
                      P=6",1,6,6);
 shift:=1+Input("EMA vertical shift %",-100,100,0)/100;
 plot:=Input("[1]EMA [2]Signals [3]Cycle [4]CyAvg [5]CyStdDev",1,6,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 zz:=Zig(x,pr,%);
 zzpk:=Ref(zz,-1)>zz AND Ref(zz,-1)>Ref(zz,-2);
 zztr:=Ref(zz,-1)<zz AND Ref(zz,-1)<Ref(zz,-2);
 PkTr:=zzpk OR zztr;CycleLen:=PkTr*(Ref(BarsSince(PkTr),-1)+1);
 CycleCount:=Cum(PkTr)-1;
 CycleCount:=If(CycleCount=0,.000001,CycleCount);
 CycleLenAvg:=Cum(CycleLen)/CycleCount;
 
 pds:=If(choose=1,ValueWhen(1,CycleLen>0 AND CycleCount>0,CycleLen),CycleLenAvg)*multi;
 Init:=CycleCount=1 AND Alert(CycleCount<1,2);
 pds:=
 If(pds>BarsSince(Init),BarsSince(Init),pds);
 pds:=If(pds<1,1,pds);
 Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 Ema:=Ema*shift;
 signals:=Cross(x,Ema)-Cross(Ema,x);
 
 If(plot=1,Ema,If(plot=2,signals,
 If(plot=3,CycleLen,
 If(plot=4,CycleLenAvg,
 If(plot=5,Stdev(CycleLen,21),pds)))))
 (Go 
                      Top) |   
                  | { 
                      Filtered Exponential Moving Average v1.1 }{ EMA ignores 
                      prices outside min/max % zone }{ EMA periodicity shortens 
                      on low bar count }{ ©Copyright 2004 Jose Silva }{ [email protected] 
                      }
 { User inputs }
 pds:=Input("EMA periods",1,2520,21);
 minCh:=Input("Minimum % price change", 0,100,2)/100;
 maxCh:=Input("Maximum % price change", 0,100,5)/100;
 x:=Input("use Open=1 High=2 Low=3 Close=4 WClose=5 
                      P=6",1,6,4);
 shift:=Input("EMA vertical shift %", -100,100,0)/100+1;
 plot:=Input("[1]EMA,  [2]Crossover signals", 1,2,1);
 
 { Price field selection }
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,P,C)))));
 
 { Price filter }
 change:=Abs(x/Ref(x,-1)-1);
 filter:=change>=minCh AND change<=maxCh;
 x:=ValueWhen(1,filter,x);
 
 { Reduce periodicity on low bar count }
 pds:=If(pds>Cum(IsDefined(x)), Cum(IsDefined(x)),pds);
 
 { EMA formula }
 Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 
 { EMA shift }
 Ema:=Ema*shift;
 
 { EMA crossover signals }
 signals:=Cross(x,Ema)-Cross(Ema,x);
 
 { Plot EMA on price chart }
 If(plot=2,signals,Ema)
 (Go 
                      Top) |   
                  | { 
                      Pivotal Exponential Moving Average v1.0 }{ EMA based on 
                      trough/peak support/resistance }{ Options:
 [1] Composite EMA: (Upper+Lower)/2;
 [2] Upper EMA band based on peaks;
 Lower EMA band based 
                      on troughs;
 [3] EMA shifts to Upper/Lower on crossovers 
                      }
 
 { ©Copyright 2004 Jose Silva }{ [email protected] 
                      }
 
 pds:=Input("EMA periods",1,2520,21)/2;
 plot:=Input("EMA: [1]Composite,  [2]Upper/Lower,  
                      [3]Long/Short",1,3,1);
 spread:=Input("Upper/Lower EMA bands shift %", 0,100,2)/200;
 x:=Input("use:  [1]Close,  [2]High/Low,  
                      [3]P", 1,3,1);
 
 xpk:=If(x=1,C,If(x=2,H,P));
 pk:=xpk<Ref(xpk,-1) AND Ref(xpk,-1)>Ref(xpk,-2);
 pkVal:=ValueWhen(1,pk,Ref(xpk,-1));
 xtr:=If(x=1,C,If(x=2,L,P));
 tr:=xtr>Ref(xtr,-1) AND Ref(xtr,-1)<Ref(xtr,-2);
 trVal:=ValueWhen(1,tr,Ref(xtr,-1));
 
 pkpds:=If(pds>Cum(pk),Cum(pk),pds);
 pkpds:=If(pkpds<1,1,pkpds);
 pkEma:=pkVal*2/(pkpds+1)+PREV*(1-2/(pkpds+1));
 pkEma:=pkEma*(1+spread);
 
 trpds:=If(pds>Cum(tr),Cum(tr),pds);
 trpds:=If(trpds<1,1,trpds);
 trEma:=trVal*2/(trpds+1)+PREV*(1-2/(trpds+1));
 trEma:=trEma*(1-spread);
 
 Ema:=(pkEma+trEma)/2;
 LngShtEma:=If(C>=Ema,trEma,pkEma);
 
 If(plot=1,Ema,If(plot=2,trEma,LngShtEma));
 If(plot=1,Ema,If(plot=2,pkEma,LngShtEma))
 (Go 
                      Top) |   
                  | {RSI-volatility 
                      adjusted, dynamic-period EMA v2}{ Tightens EMA on RSI over-bought/sold 
                      levels, increases EMA periods on low RSI volatility }{ ©Copyright 
                      2003-2004 Jose Silva }{ [email protected] }
 pds:=Input("EMA periods",1,2520,21);
 pdsRs:=Input("RSI periods",2,252,21);
 x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 
                      P=6",1,6,4);
 shift:= 1+Input("vertical shift %",-100,100,0)/100;
 plot:=Input("EMA=1, dyn EMA pds=2, RSI volatility=3, 
                      signals=4",1,4,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 RSvoltl:=Abs(RSI({x,}pdsRs)-50)+1;
 multi:=(5+100/pdsRs) /(.06+.92*RSvoltl+.02*Power(RSvoltl,2));
 pds:=pds*multi;
 pds:=If(pds>Cum(IsDefined(x))-pdsRS, Cum(IsDefined(x))-pdsRS,pds);
 pds:=If(pds<1,1,pds);
 RsVEma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 signals:=Cross(x,RsVEma)-Cross(RsVEma,x);
 
 If(plot=2,pds,If(plot=3,(RSvoltl-1)*2, If(plot=4,signals,RsVEma*shift)))
 (Go 
                      Top) |   
                  | { 
                      EMA slope % v2.0, +/- 0~100% }{ ©Copyright 2003 Jose 
                      Silva }{ [email protected] }
 pds:=Input("EMA periods",2,2520,21);
 x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 
                      P=6",1,6,4);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 EMA:=Mov(x,pds,E);
 EMAprev:=Ref(EMA,-1);
 
 y:=Min(EMA,EMAprev)/Max(EMA,EMAprev);
 EMAratio:=(If(EMA>EMAprev,2-y,y)-1)*100;
 EMAper:=If(EMAratio<0,Atan(EMAratio,1)-360, Atan(EMAratio,1))*10/9;
 signal:=Mov(EMAper,pds,E);
 
 0;signal;EMAper
 (Go 
                      Top) |   
                  | { 
                      Volatility-adjusted, dynamic-period EMA v2.4 }{ EMA periodicity 
                      shortens on high volatility, increases on low volatility 
                      }{ ©Copyright 2003-2004 Jose Silva }{ [email protected] 
                      }
 pds:=Input("EMA periods",1,2520,21);
 x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 
                      P=6",1,6,4);
 shift:=1+Input("EMA vertical shift %", -100,100,0)/100;
 plot:=Input("EMA=1, Volatility=2, Dyn EMA pds=3, Crossovers=4",1,4,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 Vt:=Stdev(x,5)/Mov(Stdev(x,5),10,S);
 pds:=pds*.75/(Vt+.1);
 pds:=If(pds>Cum(IsDefined(x))-13, Cum(IsDefined(x))-13,pds);
 pds:=If(pds<1,1,pds);
 VtEma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 VtEma:=VtEma*shift;
 signals:=Cross(x,VtEma)-Cross(VtEma,x);
 
 If(plot=2,Vt*10,If(plot=3,pds, If(plot=4,signals,VtEma)))
 (Go 
                      Top) |   
                  | { 
                      Volume adjusted, dynamic-period EMA v2.3 }{ EMA periodicity 
                      shortens on high volume, increases on low volume }{ ©Copyright 
                      2003-2004 Jose Silva }{ [email protected] }
 
 pds:=Input("EMA periods",1,2520,21);
 VAvgPds:=Input("Volume sample periods",2,252,21);
 x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 
                      P=6",1,6,4);
 shift:=1+Input("EMA vertical shift %", -100,100,0)/100;
 plot:=Input("EMA=1, Dyn EMA pds=2, Vol avg=3, Crossovers=4",1,4,1);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 MovVol:=Mov(V,VAvgPds,E);
 VolRatio:=Min(V,MovVol)/Max(V,MovVol);
 VolAvg:=If(V>MovVol,2-VolRatio,VolRatio);
 multi:=.75/(.1+.32*VolAvg+.58*Power(VolAvg,4));
 pds:=pds*multi;
 pds:=If(pds>Cum(IsDefined(x))-VAvgPds, Cum(IsDefined(x))-VAvgPds,pds);
 pds:=If(pds<1,1,pds);
 VlEma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
 VlEma:=VlEma*shift;
 signals:=Cross(x,VlEma)-Cross(VlEma,x);
 
 If(plot=2,pds,If(plot=3,VolAvg*50, If(plot=4,signals,VlEma)))
 (Go 
                      Top) |   
                  | { 
                      True weekly Close Exponential Mov Avg v4.0 }{ Plot on Daily 
                      or Weekly charts }{ References indicator "Calendar 
                      Week counter" }{ Plot is independent of any missing 
                      chart data }{ ©Copyright 2003-2004 Jose Silva }{ [email protected] 
                      }
 pds:=Input("Weekly EMA periods",1,520,4);
 shift:=1+Input("EMA vertical shift %", -100,100,0)/100;
 plot:=Input("plot:  [1] EMA,  [2] Crossover 
                      signals",1,2,1);
 
 y:=Fml("Calendar Week counter");
 Wkchart:=LastValue(Cum(y=ValueWhen(2,1,y)))=0;
 NuWk:=y>ValueWhen(2,1,y);
 pds:=If(pds>Cum(NuWk),Cum(NuWk),pds);
 WkCl:=ValueWhen(1,NuWk,ValueWhen(2-Wkchart,1,C));
 WkEma:=ValueWhen(1,NuWk,PREV)*(1-2/(pds+1))+WkCl*2/(pds+1);
 WkEma:=WkEma*shift;
 signals:=Cross(C,WkEma)-Cross(WkEma,C);
 
 If(plot=2,signals,WkEma)
 (Go 
                      Top) |   
                  | { 
                      Triggers Long (+1) & Short (-1) signals at crossover 
                      of triple EMAs within x periods }{ [email protected] 
                      }
 pdsLong:=Input("Long crossover within x periods",1,252,2);
 pdsShort:=Input("Short crossover within x periods",1,252,3);
 short:=Input("short EMA periods",1,252,5);
 medium:=Input("medium EMA periods",2,1008,10);
 long:=Input("long EMA periods",3,2520,20);
 x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 
                      P=6",1,6,4);
 
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
 
 goLong:=
 Alert(Cross(Mov(x,short,E),
 Mov(x,medium,E)),pdsLong)
 AND
 Alert(Cross(Mov(x,medium,E),
 Mov(x,long,E)),pdsLong);
 
 goShort:=
 Alert(Cross(Mov(x,medium,E),
 Mov(x,short,E)),pdsShort)
 AND
 Alert(Cross(Mov(x,long,E),
 Mov(x,medium,E)),pdsShort);
 
 goLong-goShort
 (Go 
                      Top) |   
                  |                       {Dr 
                      A. Elder's AutoEnvelope interpretation v1.0 coded by metastocktools.com}
 { User inputs }
 pds:=Input("EMA periods",1,252,21);
 pdsBak:=Input("lookback periods",1,252,42);
 x:=Input("use: Open=1, High=2, Low=3, Close=4, WClose=5",1,5,4);
 plot:=Input("[1]AutoEnvelope, [2]Long signals, [3]All 
                      signals",1,3,1);
 delay:=Input("Entry/Exit signals delay",0,5,0);
 
 { Price field }
 x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),C))));
 
 { Envelope bands }
 Avg:=Mov(x,pds,E);
 hiAvg:=HHV(H,pdsBak);
 loAvg:=LLV(L,pdsBak);
 shift:=
 Mov(If(hiAvg>Avg,hiAvg-Avg,Avg-loAvg),pds,E);
 UpperBand:=Avg+shift;
 LowerBand:=Avg-shift;
 
 { Envelope signals }
 In:=Cross(x,LowerBand);
 Out:=Cross(x,UpperBand);
 Init:=Cum(In+Out>-1)=1;
 InInit:=Cum(In)=1;
 flag:=BarsSince(Init OR In)
 <BarsSince(Init OR Out)+InInit;
 signals:=Ref((InInit AND Alert(InInit=0,2)
 OR flag AND Alert(flag=0,2))
 -(flag=0 AND Alert(flag,2)),-delay);
 
 { Plot envelope on price chart }
 If(plot=1,UpperBand,If(plot=2,signals,In-Out));
 If(plot=1,Avg,If(plot=2,0,0));
 If(plot=1,LowerBand,If(plot=2,signals,In-Out))
 (Go 
                  Top) |   
                  |                       { 
                      Dr Elder's Impulse system interpretation v1.1 coded by metastocktools.com}{ Plot signals 
                      on own window below daily chart }
 
 { Variables user-input }
 pdsNoEntry:=Input("No entry x periods from last exit",0,21,5);
 pdsW:=Input("Weekly EMA periods",1,520,13)*5;
 pdsD:=Input("Daily EMA periods",1,252,13);
 pdsShort:=Input("Shorter MACD periods",
 1,252,12);
 pdsLong:=Input("Longer MACD periods",2,2520,26);
 pdsSignal:=Input("MACD trigger signal periods",
 2,252,9);
 tradeDelay:=0;
 
 { Indicators }
 EmaW:=Mov(C,pdsW,E);
 EmaD:=Mov(C,pdsD,E);
 Mac:=Mov(C,pdsShort,E)-Mov(C,pdsLong,E);
 MacTrig:=Mov(Mac,pdsSignal,E);
 Hist:=Mac-MacTrig;
 
 { System logic }
 Out:={EmaW<Ref(EmaW,-1)
 AND }EmaD<Ref(EmaD,-1)
 AND Hist<Ref(Hist,-1);
 In1:=EmaW>Ref(EmaW,-1)
 AND EmaD>Ref(EmaD,-1)
 AND Hist>Ref(Hist,-1);
 In:=In1 AND BarsSince(Out)>pdsNoEntry;
 
 { System signals }
 Init:=Cum(In+Out>-1)=1;
 InInit:=Cum(In)=1;
 flag:=Ref(BarsSince(Init OR In)
 <BarsSince(Init OR Out)+InInit,-tradeDelay);
 signals:=(InInit AND Alert(InInit=0,2)
 OR flag AND Alert(flag=0,2))
 -(flag=0 AND Alert(flag,2));
 
 { Plot }
 0;signals
 (Go 
                  Top) |   
                  | { 
                      ©Copyright 2001 Jose Silva } Column 
                      A: +% incrs
 TtlDays:=LastValue(Cum(1));
 FirstDay:=If(TtlDays>252,TtlDays-252,1);
 FirstCl:=ValueWhen(1,Cum(1)=FirstDay,C);
 Int((C/FirstCl-1)*10000)/100
 
 Column B: today
 
 Close
 
 Column C: 52w back
 
 TtlDays:=LastValue(Cum(1));
 FirstDay:=If(TtlDays>252,TtlDays-252,1);
 ValueWhen(1,Cum(1)=FirstDay,C)
 
 Column D: $ t/over
 
 Int(WC()*V)
 
 Column E: months
 
 Int(LastValue(Cum(1)/21))
 
 Column F: weeks
 
 Int((LastValue(Cum(1))
 -Int(LastValue(Cum(1)/21))*21)/5)
 
 Filter:
 
 colA > 0
 AND colD > 10000
 (Go 
                      Top) |  
 If 
            you have Metastock formulas you would like to share,
 Please email to
  We look forward to hearing from you!
 
 To learn 
            more about how to use Metastock and its formula click 
            here.
 
 
 copyright 
            2003 MetaStock Website Home
 Metastock® 
            is a registered trademark of Equis International.
 |