Strona 1
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
Metastock Formulas - T
Click 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
|
TASC Trader's Tip: Volatility % Indicator (Dec
'97)
Tema PV Binary Wave
Tema PV Binary Wave and Tema QStick
Formulas--use of
Tema StochRSI Formula
Three inside Days
Tom Demark's Range Expansion Index
Trading the Trend 1
The New Advance Decline Line
Tick Line Momentum Oscillator
Trading Channel Index
Trailing Stop - Elder's SafeZone
Trailing Stop - MetaStock
Trendline - adjustable
Trading the Trend 2
Trailing Stop Loss Indicator
Trending Bandini
True Range Formula
True Strength Index
TSF Optimised Trading System for
Metastock
TSI and TSI Moving Average
Trendline Formula
Tushar Chande's Target Price
Tushar Chande's Vidya with
Volatility Bands
TASC Trader's Tip: Volatility % Indicator (Dec '97)
You can easily create the Volatility% Indicator from William Brower’s article in MetaStock for
Windows. First choose Indicator Builder from the Tools menu in MetaStock. Next choose
New and enter one of the following formulas:
Formula for MetaStock 6.5
Volatility%
Lookback := Input("Time Periods",1,1000,50);
HighVolatility := Input("High Volatility %",.01,100,3);
100 * Sum(100 * ATR(1)/CLOSE > HighVolatility, Lookback)/Lookback
(
Go Top
)
Tema PV Binary Wave
Use 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 a
smoothed addition of several technical indicators that each give +1 when bullish, 0 when
neutral and -1 when negative, it makes sense that a positive number is bullish and rising
numbers are bullish. Similarly negative numbers and falling numbers are bearish.
The QStick is really a candlestick type indicator, but can be read as bullish or bearish in
same way as the Binary Wave.
The two traditional ways to play them are to buy on a rise from a negative peak and sell on
a fall from a positive peak, or to buy on a zero cross over to the upside and sell on a zero
Home
MetaStock Secrets
Free MS Newsletter
Free MS Formula
Buy MetaStock
Buy MS Formulas
FREE Videos
MS Back Testing
Trading Systems
Nicolas Darvas
MetaStock Links
Rave Reviews
About Us
Contact Us
SiteMap
Strona 2
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
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.
My own MetaStock system tests alerts on the BW crossing a moving average of itself and
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 the system test. I do
use the system test as an initial screen and use a buy signal as a flag to 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.
(
Go Top
)
Tema PV Binary Wave and Tema QStick Formulas--use of
in MetaStock, from "JimG"
There are really two different ways to use these formulas. Since the Binary Wave is a
smoothed addition of several technical indicators that each give +1 when bullish, 0 when
neutral and -1 when negative, it makes sense that a positive number is bullish
and rising numbers are bullish. Similarly negative numbers and falling numbers are bearish.
The QStick is really a candlestick type indicator, but can be read as bullish or bearish in
same way as the Binary Wave.
The two traditional ways to play them are to buy on a rise from a negative peak and sell on
a fall from a positive peak, or to buy on a zero cross over to the upside and sell on 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.
My own MetaStock system tests alerts on the BW crossing a moving average of itself and
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 the system test. I do
use the system test as an initial screen and use a buy signal as a flag to 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.
The HIGHER CLOSES MetaStock exploration should be entered as follows:
colA CLOSE
colB ref(C,-1)
colC ref(C,-2)
filter colA > colB AND colB > colC
{General Purpose Intermediate Term MACD Indicator}
( Mov( C,13,E ) - Mov( C,34,E ) ) - Mov( ( Mov( C,13,E ) - Mov( C,34,E ) ),89,E )
{General Purpose Short Term MACD Indicator}
( Mov( C,8,E ) - Mov( C,17,E ) ) - Mov( ( Mov( C,8,E ) - Mov( C,17,E ) ),9,E )
(
Go Top
)
Tema StochRSI Formula
I use is Tema smoothed and I subtract 0.5 so I can plot it as a histogram. It's:}
Periods := Input("Enter Tema Smoothing Periods",5,233,13);
Tema(((RSI(Periods) - LLV(RSI(Periods),Periods)) / ((0.0001+HHV(RSI(Periods),Periods)) -
LLV(RSI(Periods),Periods))) -0.5,Periods)
(
Go Top
)
Three inside Days
Inside days suggest a volatility compression and often preceede strong breakouts. Search
returns 1 for ok and 0 for not ok
Inside()
Inside()-1
Inside()-2
(
Go Top
)
Tom Demark's Range Expansion Index
TDREI
TD1:= H-Ref(H,-2);
TD2:= L-Ref(L,-2);
TD3:= If((H>=Ref(L,-5) OR H>=Ref(L,-6)) AND (L<=Ref(H,-5) OR L<=Ref(H,-6)),1,0);
TD4:= If((Ref(H,-2)>=Ref(C,-7) OR Ref(H,-2)>=Ref(C,-8)) AND (Ref(L,-2)<=Ref(C,-7)
OR Ref(L,-2)<=Ref(C,-8)),1,0);
TD6:= (TD1) + (TD2);
TD5:= If((TD3) + (TD4)>=1, (TD6), 0);
TD7:= Abs(TD1) + Abs(TD2);
TDREI:=((TD5) + Ref(TD5,-1) + Ref(TD5,-2) + Ref(TD5,-3) + Ref(TD5,-4))/ (TD7) + Ref
Strona 3
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
(TD7,-1) + Ref(TD7,-2) + Ref(TD7,-3) + Ref(TD7,-4)*100;
TDREI;
(
Go Top
)
Trading the Trend 1
TTT--TREND TRAILING Indicator -- Andrew Abraham
Could have been called:
STOP LOSS Indicator
SUPPORT & RESISTANCE Indicator
DYNAMIC SUPPORT & RESISTANCE Indicator
BUY/SELL TRIGGER Indicator
INVESTORS DREAM Indicator
TRADING Indicator
fml("VOLAInd"): Mov(ATR(21),1,W)*3;
If(C>Ref(C,-21) AND C>fml("VOLAInd"),
HHV(H,21)-Ref(fml("VOLAInd"),-1), Ref(fml("VOLAInd"),-1)+LLV(L,21))
.or.
VOLAInd :=Mov(ATR(21),1,W)*3;
If(C>Ref(C,-21) AND C>VOLAInd, HHV(H,21)-Ref(VOLAInd,-1),
Ref(VOLAInd,-1)+LLV(L,21))
{CHANGE BAR COLORS: double click on the price plot in the chart, from the Color/Style
page click the UP drop-list and choose darkblue for upwards, and red for downward price
changes}
(
Go Top
)
Trading the Trend 2
Trading the Trend (TTT) -- by Andrew Abraham, TASC Magazine 9/1998, was about one
form of stoploss exit: subtract some manipulation of the true range from the highest high
(or add it to the lowest low) and exit when the close crosses that. (Members of Chuck
LeBeau's Traders Club will recognise the "Chandelier Exit".)
THE CHANDELIER EXIT: The exit stop is placed at a multiple of average true ranges from
the highest high or highest close since the entry of the trade. As the highs get higher the
stop moves up but it never moves downward.
In MS 6.5 as a variable or custom indicator : DaysinTrade:= Barssince(previous composite
entry criteria = 1)
THE YO YO EXIT: This exit is very similar to the Chandelier Exit except that the ATR stop is
always pegged to the most recent close instead of the highest high. Since the closes move
higher and lower, the stop also moves up and down (hence the Yo Yo name).
Name: Trading the Trend
Pds:=21;
Mult:=3;
TruRan:=Mov(ATR(1),Pds,W)*Mult;
HiLimit:=HHV(H,Pds)-TruRan;
LoLimit:=LLV(L,Pds)+TruRan;
If(C>HiLimit,HiLimit,LoLimit)
1.
After closing the Indicator Builder click on the Expert Advisor (the guy in the bowler/
derby hat).
2.
Click on New, then the Name tab, type in Trading the Trend.
3.
Click on the Highlights tab, select the first line so that it is highlighted, click Edit,
type in the name Uptrend, select Colour Blue, select Condition, type in C>FmlVar
("Trading the Trend","HiLimit"), and click OK,
4.
Still on the Highlights tab, select the second line, click Edit, type in the name
Downtrend, select Color Red, select Condition, type in C<=FmlVar("Trading the
Trend","HiLimit"), click OK, and then click OK again.
5.
If you have a chart open that you want to use this on, click Attach, otherwise click
Close. In the latter case, when you open a chart and plot the trendline, click on the
Expert Advisor, select Trading the Trend, and click on Attach.
I've given the Expert steps in detail for any who may not be familiar with its use. To
experiment with variations in the lookback periods and the multiplier you can do so in either
the Indicator Builder, or right-click the indicator on the chart, select Properties, then the
Formula tab, and make the changes (e.g. try a lookback period of 10, and a multiplier of
2.5). As implemented above, the Expert should change accordingly. This shows the trade-
offs that have to be made
between near and distant stops. This is too rudimentary to be traded as a system - the
Strona 4
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
whipsaws would chop you to pieces - but the exits should help to limit drawdowns.
A very similar stoploss is given in Chande & Kroll "The New Technical Trader", pp.167 - 169,
"Volatility-Based Trailing Stops". My preference is to plot both the high and the low exit
lines in contrasting colours, dispensing with the switch between them, and dispensing with
the Expert. If anyone wants help with the code, just say so.
Assuming you entered everything exactly in both the Indicator Builder and the Expert
Advisor, one question comes to mind. Did you decide to adapt the formula to MS v.6.5 and
use an Input function for Pds and Mult? It seems like a logical thing to do, and in fact I
coded it that way at first. The problem is that the Expert Advisor always reverts to the
default value (the System Tester does the same thing).
Thus if you used something like:
Pds:=Input("Lookback Periods?",1,1000,20)
and then when you applied it you changed the periods to 15, the Expert Advisor will still
read 20. I hard-coded the Pds and Mult parameters for that reason.
(
Go Top
)
Trailing Stop Loss Indicator
If(cum(1)=1,
{then} Close,
{else} If((C*1.1) <= PREV,
{then}(C*1.1),
{else} PREV));
{from Adam Hefner}
{Regarding the Recursive Moving Trendline System, I ended up making an oscillator out of
it (subtracting the ema from the rta). If you wish to try "tuning" it in MetaStock, you could
try different entry levels from the oscillator. For example, go long when TOSC crosses from
below -2, or go short when TOSC crosses from above +2. }
{TOSC}
Lb:=Input("Look-Back Period?",3,100,21);
Ty:=Input("1=C 2=H 3=L 4= Median Price",1,4,1);
Tv:=If(Ty=1,C,If(Ty=2,H,If(Ty=3,L,MP())));
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+Tv;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+
(Alpha*(Tv+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(Tv,lb,E);
TOSC;
{NOTE: this code will work slowly because of all of the "PREV" functions. from Adam
Hefner.}
{Single 60 Day Period BreakOut Signal Indicator}
ACol:= C;
BCol:= Ref(HHV(H,59), -1);
CCol:= HHV(H,60);
SSDPBOS:= (ACol>BCol) AND (Ref(C,-1)<BCol) AND
(H=CCol);
SSDPBOS
(
Go Top
)
Trending Bandini
Mov(C,2,S)>
Mov(Mov(C,2,S),2,S) AND
Mov(Mov(C,2,S),2,S)>
Mov(Mov(Mov(C,2,S),2,S),2,S) AND
Mov(Mov(Mov(C,2,S),2,S),2,S)>
Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S) AND
Mov(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) AND
Mov(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) AND
Mov(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) AND
Mov(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) AND
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)>
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)
AND
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)>
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)
(
Go Top
)
Strona 5
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
True Range Formula
TR = (H - L + Abs(H - Ref(C,-1)) + Abs(L - Ref(C,-1)) )/2
(
Go Top
)
True Strength Index
{Appeared in the January 1993 issue of Stocks & Commodities magazine}
100 * ( Mov( Mov( ROC(C,1,$),25,E),13,E) / Mov( Mov( Abs(ROC(C,1,$)),25,E),13,E))
(
Go Top
)
TSF Optimised Trading System for Metastock
Enter long:
Cross(opt1,((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100))
Close long:
Cross(((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100),opt2)
Enter short:
Cross(((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100),opt2)
Close short:
Cross(opt1,((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100))
opt 1: zero to -2 (with .1 step)
opt 2: zero to +2 (with .1 step)
opt 3: 2 to 8 (with 1 step)
{I use this for futures and the above parameters (optimized settings) keep it in the ballpark.
If you are applying it to equities (or commodities), it always makes sense to look at the
indicator and understand the outside parameters for each of its "steps". It makes no sense
to limit your outside limits to -2 and +2 if the TSF oscillates between -8 and +8. So do a
little homework on the "outside" limits of the indicator and then optimize accordingly. from
Steve Karnish.}
(
Go Top
)
TSI and TSI Moving Average
100*(Mov(Mov(Roc(C,1,$),25,E),13,E)/Mov(Mov(Abs(Roc(c,1,$)),25,E),13,E))
Mov(Fml("TSI"),20,E)
(
Go Top
)
The New Advance Decline Line
The formulas and steps necessary to do the New Advance -Decline Line from the September
1994 Technical Analysis of Stocks & Commodities, page 14 by Daniel Downing are:
Taken from Stocks & Commodities, V. 12:9 (363-365): A New Advance-Decline Line by
Daniel E. Downing
"Here's a trading tool that uses a unique version of the daily advance-decline line of the
New York Stock Exchange (NYSE). This version helps in our short- and long-term trading of
index options and stock index futures. It gives many good short-term trading signals and
excellent but infrequent longer-term signals…
The philosophy behind this tool is that the short-term trader's capital is finite and that
traders have to reliquify their holdings after a period. Traders can buy and try to push the
equities higher only so many times before they need to reliquify, just as only a finite amount
of selling waves can take place before the sellers are out of supplies. A tool that points to
when short-term traders need to reliquify their positions will also spot when the markets will
soon reverse their trends."
For the Windows versions of MetaStock:
Load the advances
Load the declines
Drag the plot of the advances into the chart of the declines
Plot the following custom formula directly on the plot of advances.
Cum( If( P ,>= ,1000 ,If(C ,< ,1000 , + 1 ,0 ) ,If( C ,>= ,1000 ,-1 ,0 ) ) )
Strona 6
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
(
Go Top
)
Tick Line Momentum Oscillator
In his article "Using The Tick In A Short-Term Indicator", in the January 94 issue of TASC,
Daniel E. Downing presents the Tick Line Momentum Oscillator.
Taken from Stocks & Commodities, V. 12:1 (42-44): Using The Tick In A Short-Term
Indicator by Daniel E. Downing
"The tick index, the net difference of the numbers of stocks last traded on an uptick from
those last traded on a downtick , is a well-known indicator, but it's got a problem. The raw
number result is volatile, perhaps too volatile for some. What to do? here, then, is a way to
smooth out the noise to identify short-term trading opportunities.
The tick is a basic unit for the markets, watched with fascination during periods of turmoil
and periods of enthusiasm. It is quoted throughout the day on most quote services. In
addition, the closing tick value can be found on the market statistics pages of financial
newspapers such as Barron's and The Wall Street Journal. Let me present, then, the tick
line momentum oscillator, which is based on the closing value for the New York Stock
Exchange (NYSE) tick indicator. The oscillator has been shown to have a good track record
of determining when the NYSE is overbought or oversold on a short-term basis. The formula
for the tick line momentum oscillator is simple and can be easily calculated without a
computer, although a spreadsheet
version can be found
in the sidebar, "Tick
line
momentum." Finally, the oscillator is straightforward and simple to apply."
The MetaStock formula for the Tick Line Momentum Oscillator is:
Mov( ROC( Cum( If( C ,> ,Ref( Mov(C ,10 ,E ) ,-1 ) ,+1 ,If( C ,< ,Ref( Mov( C ,10 ,E )
,-1 ) ,- 1 ,0 ) ) ) ,5 ,$ ) ,5 ,E )
(
Go Top
)
Trading Channel Index
The Trading Channel Index comes from an early version of AIQ's Stock Expert program.
"The Trading Channel Index measures the location of average daily price relative to a
smoothed average of average daily price. It is derived from the average difference between
these two values."
To create the Trading Channel Index in MetaStock create the following custom formula's:
AP+: Average price
( H + L + C ) / 3
ESA+: Smoothed price average
Mov( Fml( "AP+" ) ,10 ,E ) + ( Mov( Ref( Fml( "AP+" ) ,-1 ) ,10 ,E ) )
D+: Price range estimate
Mov( ( Fml( "AP+" ) - Fml( "ESA+" ) ) ,10 ,E ) + ( Mov( Ref( Fml( "AP+" ) - Fml( "ESA+" )
,-1 ) ,10 ,E ) )
CI+: Channel index
( ( Fml( "AP+" ) - Fml( "ESA+" ) ) / ( 0.015 * Fml( "D+" ) ) )
TRADING CHANEL INDEX:
Mov( Fml( "CI+" ) ,21 ,E ) + ( Mov( Ref( Fml( "CI+" ) ,-1 ) ,21 ,E ) )
(
Go Top
)
Trendline Formula
Trough(1,L,10)+((((Trough(1,L,10)-Trough(2,L,10))/(TroughBars(2,L,10)-TroughBars
(1,L,10)))
*TroughBars(1,L,10)))
This formula will draw a trendline from the most recent bottom.
The L (low) can be changed to C (close) and the 10 can be changed to a different percent
value.
You will also need to change the line style to the last one in thedrop down list.
(
Go Top
)
Tushar Chande's Target Price
A:=Mov(Abs(C-Ref(C,-1)),10,S);
TPH1:=C+A;
TPH2:=C+(2*A);
Strona 7
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
TPL1:=C-A;
TPL2:=C-(2*A);
TPH1;
TPH2;
TPL1;
TPL2;
(
Go Top
)
Tushar Chande's Vidya with Volatility Bands
K:=Stdev(C,5)/Mov(Stdev(C,5),20,S);
SC:=0.9;
Vidya:=SC*K*C+(1-SC*K)*Ref(C,-1);
UpperBand:=Vidya+2*.5*K;
LowerBand:=Vidya-2*.5*K;
UpperBand;
LowerBand;
Vidya;
(
Go Top
)
Trailing Stop - Elder's SafeZone
{ Dr Alexander Elder's SafeZone trailing stop v2 }{ Triggers: Long (+1) & Short (-1) signals
at crossover of user-defined trailing stops }{ ©Copyright 2003 Jose Silva }{ josesilva22@
yahoo.com }
coefficient:=Input("SafeZone coefficient",
0,10,2.5);
bkpds:=Input("Lookback periods",1,252,10);
pds:=Input("Trend EMA periods",2,252,21);
adv:=Input("plot: today's SafeZone=0, tomorrow's stop=1",0,1,0);
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
delay:=Input("Entry and Exit signal delay",
0,5,0);
DwSidePen:=Mov(C,pds,E)>Ref(Mov(C,pds,E),-1)
AND L<Ref(L,-1);
DwSideDiff:=If(DwSidePen,Ref(L,-1)-L,0);
DwPenAvg:=Sum(DwSideDiff,bkpds)
/(Sum(DwSidePen,bkpds)+.000001);
StLong:=Ref(L-DwPenAvg*coefficient,-1);
StopLong:=If(C<PREV,StLong,Max(StLong,PREV));
UpSidePen:=Mov(C,pds,E)<Ref(Mov(C,pds,E),-1)
AND H>Ref(H,-1);
UpSideDiff:=If(UpSidePen,H-Ref(H,-1),0);
UpPenAvg:=Sum(UpSideDiff,bkpds)
/(Sum(UpSidePen,bkpds)+.000001);
StShort:=Ref(H+UpPenAvg*coefficient,-1);
StopShort:=If(C>PREV,StShort,Min(StShort,PREV));
In:=Cross(C,Ref(StopShort,-1));
Out:=Cross(Ref(StopLong,-1),C);
flag:=BarsSince(Cum(In+Out>-1)=1 OR In)
< BarsSince(Cum(In+Out>-1)=1 OR Out)
+(Cum(In)=1);
signals:=Ref((Cum(In)=1
AND Alert((Cum(In)=1)=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
If(plot=1,Ref(If(flag=1,stopLong,stopShort),
-1+adv),If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,Ref(If(flag=1,stopLong,stopShort),
-1+adv),If(plot=2,Ref(stopShort,-1+adv),
signals))
(
Go Top
)
Trailing Stop - MetaStock
{ Triggers: Long (+1) & Short (-1) signals at crossover of user-defined trailing stops }{ x23
slower than TradeSim's version }{ ©Copyright 2003-2004 Jose Silva }{ josesilva22@
yahoo.com }
buffer:=Input("buffer % trailing stop",0,100,8);
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
delay:=Input("Entry and Exit signal delay",
0,5,0);
StLong:=C-C*buffer/100;
StShort:=C+C*buffer/100;
stopLong:=If(C<PREV,StLong,Max(StLong,PREV));
Strona 8
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
stopShort:=If(C>PREV,StShort,Min(StShort,PREV));
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
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);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
Trailing Stop - TradeSim
{ Triggers: Long (+1) & Short (-1) signals at crossover of user-defined trailing stops }{ x23
faster than MetaStock's 4-PREV version }{ TradeSim.dll must be in
...\MetaStock\External Function DLLs\ folder }{ ©Copyright 2003-2004 Jose Silva }
{ josesilva22@yahoo.com }
buffer:=Input("buffer % trailing stop",0,100,8);
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
delay:=Input("Entry and Exit signal delay",
0,5,0);
Volatility:=C*buffer/100;
stopLong:=ExtFml("TradeSim.TrailingStop",
BAND, {mode: band or trigger}
LONG, {long or short}
Volatility, {user defined see variable above}
CLOSE, {RefPoint for stop calc}
CLOSE); {threshold - stop breached}
stopShort:=ExtFml("TradeSim.TrailingStop",
BAND,SHORT,Volatility,C,C);
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
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);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
Trailing Stop - AdvTrailStop plug-in
{ Plot on price chart }{ Triggers: Long (+1) & Short (-1) signals at crossover of user-
defined trailing stops }{ Much faster than MetaStock's 4-PREV version }{ ©Copyright 2004
Jose Silva }{ josesilva22@yahoo.com }
{ AdvancedStop.dll must be in ...\MetaStock\External Function DLLs\ folder }
{ AdvancedStop.dll by Richard Dale, free from: http://www.tradernexus.com/advancedstop/
advancedstop.html }
buffer1:=
Input("initial stop % buffer",0,100,5)/100;
buffer2:=
Input("trailing stop % buffer",0,100,8)/100;
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
delay:=Input("Entry and Exit signal delay",
0,5,0);
entrySignal:=C=C;
initialStopLong:=C*(1-buffer1);
trailStopLong:=C*(1-buffer2);
stopLong:=ExtFml("AdvancedStop.StopLong",
entrySignal,initialStopLong,0,trailStopLong,
0,0,0,0);
exitSignal:=Cross(stopLong,C);
initialStopShort:=C*(1+buffer1);
trailStopShort:=C*(1+buffer2);
stopShort:=ExtFml("AdvancedStop.StopShort",
Strona 9
Metastock Formulas - T
2014-10-14 14:05:43
http://www.meta-formula.com/Metastock-Formulas-T.html
exitSignal,initialStopShort,0,trailStopShort,
0,0,0,0);
entrySignal:=Cross(C,stopShort);
stopLong:=ExtFml("AdvancedStop.StopLong",
entrySignal,initialStopLong,0,trailStopLong,
0,0,0,0);
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+(Cum(In)=1);
signals:=Ref(((Cum(In)=1)
AND Alert((Cum(In)=1)=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
(
Go Top
)
Trendline - adjustable
{ ©Copyright 2003 Jose Silva }{ josesilva22@yahoo.com }
pds:=
Input("average trend length periods",2,252,21);
pr:=Input("Open=1 High=2 Low=3 Close=4 Vol=5 MP=6, P=7",1,7,4);
display:=Input("plot Trend line = 1, Trend points = 2",1,2,1);
{define events}
pr:=If(pr=1,O,If(pr=2,H,If(pr=3,L,If(pr=5,V,
If(pr=6,MP(),If(pr=7,P,C))))));
price1:=pr;
price2:=pr;
time1:=price1>Ref(HHV(price1,pds),-1);
time2:=price2<Ref(LLV(price2,pds),-1);
{restrict to last events}
time1:=time1
AND Cum(time1)=LastValue(Cum(time1));
time2:=time2
AND Cum(time2)=LastValue(Cum(time2));
{sort events}
t1pds:=LastValue(BarsSince(time1));
t2pds:=LastValue(BarsSince(time2));
x1:=If(t1pds>=t2pds,time1,time2);
x2:=If(t1pds>=t2pds,time2,time1);
y1:=If(t1pds>=t2pds,price1,price2);
y2:=If(t1pds>=t2pds,price2,price1);
{fix coordinates}
y1:=ValueWhen(1,x1,y1);
y2:=LastValue(ValueWhen(1,x2,y2));
b1:=LastValue(BarsSince(x1));
b2:=LastValue(BarsSince(x2));
plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2);
If(display=1,plot,time1+time2)
(
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.