Page 10
Creating Dynamic Vertical Lines
from Ken
These are dynamic moving vertical lines. Each new bar causes the
line to move orward one bar.
How to Create a Vertical Line in MetaStock
{Plot in Stoch window}
{...you can change the 100 and 0 to 80/20 or ?}
n:=Input("Bars Before LastLoadedBar", 0,1000,89);
LastLoadedBarNum:=LastValue(Cum(1));
If(Cum(1)=(LastLoadedBarNum-n)+1,100,0)
....or
Create a new Expert.
Place the following in "Trends"/"Bullish".
n:=89;
LastLoadedBarNum:=LastValue(Cum(1));
Cum(1)=(LastLoadedBarNum-n)+1
In "Corner", UNcheck "Display symbol in Expert corner".
In "Ribbon", check Display Ribbon, Display Vertical Line, and
"Ribbon's inner window".
Delete or rename the "Neutral" label.
Choose Bullish color.
Plot Stochastic on chart, attach Expert, then drag Expert to
Stochastic inner window
Support and Resistance
I wrote this MetaStock Expert for calculating the support 1 & 2 and
resistance 1 & 2 as per Futures magazine, October 1999, page 52.
FIRST RESISTANCE: WRITEVAL(-L+(2* (H+L+C)/3),1.2)
SECOND RESISTANCE: WRITEVAL(((H+L+C)/3) +((-L+(2*
(H+L+C)/3))-(-H+(2* (H+L+C)/3))),1.2)
FIRST SUPPORT:
WRITEVAL(-H+(2*(H+L+C)/3),1.2)
SECOND SUPPORT: WRITEVAL(((H+L+C)/3)
-((-L+(2* (H+L+C)/3))-(-H+(2* (H+L+C)/3))),1.2)
from Mike Arnoldi
Volume
Accumulation Percentage
I contacted David Vomund by e-mail and he was kind enough
to mail me the equations required to calculate the VAP. I've
programmed them in MetaStock as follows:
VOLUME ACCUMULATION PERCENTAGE
Periods:=Input("Time Periods",1,60,21);
X:=(2*C-H-L)/(H-L);
TVA:=Sum(V*x,Periods);
TV:=Sum(V,Periods);
VA:=100*TVA/TV;
VA
from Tom Strickland
Alligator Indicators
from Gary Randall -- Brunswick, Maine
Alligator Indicators - Bill William, "Trading Chaos"
----------------------------------------------
Chaos Blue BL
{Alligator Blue Balance Line - Jaw}
{13 bar smoothed average offset 8 bars}
Ref(Wilders(MP(),13),-8);
----------------------------------------------
Chaos Red BL
{Alligator Red Balance Line - Teeth}
{8 bar smoothed average offset 5 bars}
Ref(Wilders(MP(),8),-5);
----------------------------------------------
Chaos Green BL
{Alligator Green Balance Line - Lip}
{5 bar smoothed average offset 3 bars}
Ref(Wilders(MP(),5),-3);
----------------------------------------------
Chaos Gator
{ Chaos Alligator }
{ Plot as histogram }
green := Fml("Chaos Green");
red := Fml("Chaos Red");
blue := Fml("Chaos Blue");
If(green > red AND red > blue, green - blue,
If(blue > red AND red > green, green - blue, 0));
----------------------------------------------
Chaos AO
{ Chaos Awsome Oscillator - measures momentum }
( A very close approximation of MFI }
{ Plot as histogram }
Mov(MP(),5,S) - Mov(MP(),34,S);
----------------------------------------------
Chaos AO Signal Line
{ Chaos Awsome Oscillator Signal Line }
{ Plot as line over AO histogram }
Mov(Mov(MP(),5,S) - Mov(MP(),34,S),5,S)
----------------------------------------------
Chaos AC
{ Chaos Accelerator/Decelerator Oscillator }
{ Measures acceleration }
{ Plot as histogram }
Fml("Chaos AO") - Mov(Fml("Chaos AO"),5,S);
----------------------------------------------
Chaos Fractal
{ Chaos Fractal (simple version +1=Up, -1=Dn) }
High1 := Ref(HIGH,-2);
High2 := Ref(HIGH,-1);
High3 := Ref(HIGH,0);
High4 := Ref(HIGH,1);
High5 := Ref(HIGH,2);
Low1 := Ref(LOW,-2);
Low2 := Ref(LOW,-1);
Low3 := Ref(LOW,0);
Low4 := Ref(LOW,1);
Low5 := Ref(LOW,2);
Fractal :=
If((High3 > High1) AND (High3 > High2) AND (High3 > High4) AND
(High3
>
High5), +1,0);
Fractal :=
If((Low3 < Low1) AND (Low3 < Low2) AND
(Low3 < Low4) AND (Low3 < Low5),
If(Fractal > 0, 0, -1), Fractal);
Fractal;
Experimental Williams Trading System
A trading system based on work of Bill Williams from
jcob3@prodigy.com
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.
Jeff
Shifted TSMA Indicator
You could use the Reference (Ref) function to shift your indicator
back in time and you could add or multiply by a constant or variable
to give your indicator a vertical shift. I've never used a time
series moving average so
I'm kind of out of my league, but I guess it could look like this:
TSMA:= Mov(CLOSE,5,TIMESERIES);
ShiftedTSMA:= Ref(TSMA, -1) + 2;
ShiftedTSMA
from Ken Wallace
gcwallace@home.com
DMTF
Trading System
I know I'm a little slow, but I've just gotten around to working on
the Dynamic Multiple Time Frame indicators given by Robert Krausz in
the 1999 Bonus Issue of TASC.
The code for the actual indicators can be found at the Equis website
(www.equis.com) so I won't post them again here. I've been testing a
system based on these indicators on Best Buy (a stock that seems to
be quite amenable to system trading) and getting very good results.
The system is currently for long trades only; I'll work on shorting
later. Here's what I've got so far
Enter Long:
day:=DayOfWeek();
Fml("dynamic balance")>Fml("dynamik balance point steps")
AND Fml("fixed balance point")>Ref(Fml("fixed balance Point"),-5)
OR Fml("tendency")>0 AND day=5
Close Long
Cross(Fml("dynamik balance point steps"),Fml("dynamic balance"))
AND Fml("fixed balance point")<Ref(Fml("fixed balance Point"),-5)
The problem is that the close is not defined, meaning that the two
events which initiate the close do not have to happen. The DBPS can
cross the DB without the 2nd condition occuring. Then, when later,
the 2nd condition does occur, sell is not triggered because the
cross over has not happened simultaneously with the 2nd condition.
Theoretically, if we follow the system strictly, this can lead to a
complete loss. I understand that I can set arbitrary stops, but I
prefer to let the system do the work. Simply reversing the entry
signal and other tries, such as support breakthoughs, drastically
reduce the result.
Regards,
Jeff jcob3@prodigy.net
Coding
Example
If yesterdays high is greater than the high of 2 days ago// and the
low 5 days ago is less than or equal to the high 4 days ago// and it
is Wednesday
Try this:
Ref(H,-1)>Ref(H,-2) AND
Ref(L,-5)<=Ref(H,-4) AND
Dayofweek() = 3
from Paul Beattie
Persistance of Money Flow
Chaikin's Money Flow is a built-in MetaStock indicator, as follows:
cmf(periods)
Persistence of Money Flow (PMF%)
Pds1:= Input("CMF Periods?",1,100,21);
Pds2:= Input("PMF Periods?",10,1000,120);
Sum((cmf(Pds1)>0),Pds2)/(Pds2/100)
{from HHP}
Persistence or (PMF%) is the percentage of days over 6 months that
the Chaikin Money Flow Oscillator is above 0. The Chaikin Money Flow
Oscillator formula default uses a 21 day money flow sum divided by
the 21 day sum
of daily volume. HHP sent the correct indicator formula for
persistence, tho you can modify it by selecting 1 for "Pds1" if you
prefer to create a 120 day cumulative money flow indicator to do
what you are suggesting. The cumulative money flow indicator often
uses a 90SMA trigger.
{from Craig DeHaan}
StochPVT Indicators
Though not directly related to the volume percent indicator, I have
recently been using a volume indicator that I wrote myself in
MetaStock's formula language. It uses the same idea that Chande used
to turn RSI into the
StochRSI oscillator and the preprogrammed Price Volume Trend
function. Price Volume Trend is similar to On Balance Volume, except
that as the volume is accumulated, it is weighted according to the
percent price change from the previous close.
I use fast and slow "stochastic" lines to judge when either
accumulation or distribution is taking place. I used a look back
period of 19 days which fits my style. Signals are generated by the
fast crossing above or below the slow lines. I have not worked with
it enough to say whether or not divergences offer signals too.
Formulas for the StochPVT are shown below:
{Fast line}
Mov((PVT()-LLV(PVT(),19))/
(HHV(PVT(),19)-LLV(PVT(),19)), 5, S)
{Slow Line}
Mov(Mov((PVT()-LLV(PVT(),19))/
(HHV(PVT(),19)-LLV(PVT(),19)), 5, S),3,S)
{from harelsdb@aol.com}
One
Day Money Flow
The One Day Money Flow Indicator (some also call this indicator the
One Day Accumulation/Distribution Indicator) MetaStock formula is
the following:
(((Close-Low) - (High-Close)) / (High-Low)) * Volume
{from Marcel Knechtle}
INSYNC
Index
The formula from Equis: Insync Index (rev. 01/06/97)
The interpretation for the following formulas came from the article
"The Insync Index", by Norm North, in Technical Analysis of Stocks &
Commodities Jan 1995.
All of these formulas are necessary for the last one, Insync Index
to run properly. They are listed in the order in which they should
be copied and pasted into the MetaStock Formula Builder
BOLInSLB
Mov( C ,20 ,S ) - 2 * ( Std( C ,20 ) )
BOLInSUB
Mov( C ,20 ,S ) + 2 * ( Std( C ,20 ) )
BOLInS2
( C - Fml( "BOLInSLB" ) ) / ( Fml( "BOLInSUB" ) - Fml( "BOLInSLB" )
)
BOLInSLL
If( Fml( "BOLInS2" ) ,< , .05 ,-5 ,If( Fml( "BOLInS2" ) ,> ,.95 ,5
,0 ) )
CCIInS
If( CCI(14 ) ,> ,100 ,5 ,If ( CCI(14 ) ,< ,-100 ,-5 ,0 ) )
EMVInS2
EMV(10 ,S ) - Mov( EMV(10 ,S) ,10 ,S )
EMVInSB
If( Fml( "EMVInS2" ) ,< ,0 ,If( Mov( EMV(10 ,S ) ,10 ,S ) ,< ,0 ,-5
,0 ) ,0 )
EMVInSS
If( Fml( "EMVInS2" ) ,> ,0 ,If( Mov( EMV(10 ,S ) ,10 ,S ) ,> ,0 ,5
,0 ) ,0 )
MACDInS2
MACD( ) - Mov( MACD( ) ,10 ,S )
MACDinSB
If( Fml( "MACDInS2" ) ,< ,0 ,If( Mov( MACD( ) ,10 ,S ) ,< ,0 ,-5 ,0
) ,0 )
MACDInSS
If( Fml( "MACDInS2" ) ,> ,0 ,If( Mov( MACD( ) ,10 ,S) ,> ,0 ,5 ,0 )
,0 )
MFIInS
If( MFI( 20 ) ,> ,80 ,5 , If( MFI( 20 ) ,< ,20 ,-5 ,0 ) )
PDOInS2
DPO( 18 ) - Mov( DPO( 18 ) ,10 ,S )
PDOInSB
If( Fml( "PDOInS2" ) ,< ,0 ,If( Mov( DPO( 18 ) ,10 , S) ,< ,0 ,-5 ,0
) ,0 )
PDOInSS
If( Fml( "PDOInS2" ) ,> ,0 ,If( Mov( DPO ( 18 ) ,10 ,S) ,> ,0 ,5 ,0
) ,0 )
ROCInS2
ROC( C ,10 ,$ ) - Mov( ROC( C ,10 ,$ ) ,10 ,S )
ROCInSB
If( Fml( "ROCInS2" ) ,< ,0 ,If( Mov( ROC( C ,10 ,$ ) ,10 ,S ) ,< ,0
,-5 ,0 ) ,0 )
ROCInSS Index
If( Fml( "ROCInS2" ) ,> ,0 ,If( Mov( ROC( C ,10 ,$ ) ,10 ,S ) ,> ,0
,5 ,0 ) ,0 )
RSIInS
If( RSI(14 ) ,> ,70 ,5 ,If( RSI(14 ), < ,30 ,-5 ,0 ) )
STO%dInS
If( Stoch(14 ,3 ) ,> ,80 ,5 ,If( Stoch(14 ,3 ) ,< ,20 ,-5 ,0 ) )
STO%kInS
If( Stoch(14 ,1) ,> ,80 ,5 ,If( Stoch(14 ,1 ) ,< ,20 ,-5 ,0 ) )
InSync Index
50 + Fml( "CCIInS" ) + Fml( "BOLInSLL" ) + Fml( "RSIInS" ) + Fml(
"STO%kInS " ) + Fml( "STO%dInS" ) + Fml( "MFIInS" ) + Fml( "EMVInSB"
) + Fml( "EMVInSS" ) + Fml( "ROCInSS" ) + Fml( "ROCInSB" ) + Ref
(Fml( "PDOInSS" ) ,-10 ) + Ref (Fml( "PDOInSB" ) ,-10 ) + Fml(
"MACDInS S" ) + Fml( "MACDInSB" )
These formulas were provided by Barry Millman. All questions
should be addressed to him at 73374.1364@Compuserve.com.
Mr. Millman wrote these formulas using many Custom Formula slots for
clarity and ease of understanding. Please note that the final
formula `InSync Index' requires all of the previous formulas to be
correct.
Multipart Formulas
QUESTION:
I've got a specific question. I use WOW and MetaStock. Suppose I've
got some indicator that ranges from 0 to 100 and I have a system
that says "buy when the indicator goes above 90 and hold until it
goes below 10 and then sell" or something. Notice that if the
indicator is between 10 and 90 that you don't know whether that's a
hold or a don't hold unless you know whether it last crossed 90 or
10. So far so good. Now suppose I want to combine the signal from
this system with another indicator/system so that I can say
something like "buy when system #2 says buy only if system #1 is in
"hold the stock" mode." This may take the form of another indicator
that is "1" when the system is in hold mode and "0" when it is in
don't hold mode. This seems like a general problem that must come up
often but it is not obvious to me how to code it. I'll bet other
people could benefit from the answer as well.
Bob Anderton
ANSWER:
Thanks to all of you for the great help and input to the question of
how to deal with combining the indicators in a system when one of
them gives a signal by crossing. There were two responses, one can
be seen in #3310 from Larry on the Yahoo! MetaStock board (thanks
Mike) which is answering a slightly different question. That
solution seems like what one would use if one wanted to look for
system 2 signalling a buy the same day as system 1 signalling a buy
by crossing a value. What I actually wanted to do was have a way of
looking for system 2 signalling a buy during anytime that system 1
was saying hold because its last signal had been a buy.
This was addressed very nicely by Paul in message #3311. I took his
idea to make the following indicator:
If(BarsSince(Cross(Fml("Indicator1"),90))<BarsSince(Cross(10,Fml("Indicator1"))),1,0)
This makes a new indicator that is 1 when the last signal is a buy
and 0 when the last signal was a sell. Imagine that this is a really
long term indicator. Now you can look for your short term indicator
#2 to signal a sell and just AND it with this new indicator being =
1, meaning that the first indicator was in hold mode.
This is a big step forward for me. I'd never used this BARSSINCE
function before(which is PERIODSSINCE for WOW) and this was key to
being able to do this I think.
Bob Anderton
Gap
Trading
Here is the gap-trading system code for use in Equis International's
MetaStock software. For practical reasons, the system has been
defined as an indicator rather than a system, showing the cumulated
profit.
dn:= 1.0;
up:= 1.0;
gap:= 100*(OPEN - Ref(CLOSE, -1))/Ref(CLOSE, -1);
prf:= If(gap>=up, OPEN-CLOSE, If(gap<=-dn, CLOSE-OPEN,0));
Cum(prf);
Stéphane Reverre
Chandlier Exit
The exit system you use is at least as important as the entry
system.
Below is the code for Chuck LeBeau's Chandelier Exit. The Chandelier
Exit is a volatility based exit (it uses average true range) that
works quite well on trend following systems. It lets "... profits
run in the direction
of a trend while still offering some protection against any reversal
in trend."
The theory is quite simple, but because of the awkwardness of
defining the entry price, its implementation in MetaStock takes some
work. The theory is: exit a long position at either the highest high
since entry minus 3
ATRs, or at the highest close since entry minus 2.5 ATRs.
The exit is descibed more fully in the Trader's Toolkit section at
Chuck LeBeau's site -- http://traderclub.com/
Here is the MetaStock code:
{LONG EXIT}
LongEntry:= {this your entry system, eg. Cross(CLOSE, Mov(C,20,E))};
MoneyMgmtStop:= {this is your maximum loss, in points};
{DEFINE ENTRY PRICE, WITH EXIT BEING -ENTRY PRICE AND NO TRADE BEING
0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= PREV - MoneyMgmtStop, -PREV,
If(LOW <= HighestSince(1,PREV=0, HIGH) - 3 * ATR(10), -PREV,
If(LOW <= HighestSince(1,PREV=0, CLOSE) - 2.5 * ATR(10), -PREV,
PREV))));
{EXIT IF ENTRY PRICE < 0 (MEANING EXIT)}
EntryPrice < 0
{SHORT EXIT}
ShortEntry:= {this your entry system, eg. Cross(Mov(C,20,E),
CLOSE)};
MoneyMgmtStop:= {this is your maximum loss, in points};
{DEFINE ENTRY PRICE, WITH EXIT BEING -ENTRY PRICE AND NO TRADE BEING
0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(ShortEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(HIGH >= PREV + MoneyMgmtStop, -PREV,
If(HIGH >= LowestSince(1,PREV=0, LOW) + 3 * ATR(10), -PREV,
If(HIGH >= LowestSince(1,PREV=0, CLOSE) + 2.5 * ATR(10), -PREV,
PREV))));
{EXIT IF ENTRY PRICE < 0 (MEANING EXIT)}
EntryPrice < 0
{from Glen Wallace}
Projected Range
From "Lyn Maine"
This is
Tom DeMark's Projected Range:
TPH1:=(H+C+2*L)/2-L;
TPH2:=(2*H+L+C)/2-L;
TPH3:=(H+L+2*C)/2-L;
TPL1:=(H+C+2*L)/2-H;
TPL2:=(2*H+L+C)/2-H;
TPL3:=(H+L+2*C)/2-H;
PH:=If((C<O),TPH1,If((C>O),TPH2,If((C=O),TPH3,0)));
PL:=If((C<O),TPL1,If((C>O),TPL2,If((C=O),TPL3,0)));
PH;
PL;
This is my updated version of Tushar Chande's Vidya
Vidya:
K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);
SC:=Input("SC",.1,.9,.1);
Vidya:=SC*K*P+(1-SC*K)*Ref(P,-1);
Vidya;
{the sc input is more responsive if you use a higher number}
This is 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;
This is Tushar Chande's target price:
A:=Mov(Abs(C-Ref(C,-1)),10,S);
TPH1:=C+A;
TPH2:=C+(2*A);
TPL1:=C-A;
TPL2:=C-(2*A);
TPH1;
TPH2;
TPL1;
TPL2;
This is ATR Ratio to Close:
ATRR:= ATR(5)/C;
MATRR:=Mov(ATRR,3,E);
ATRR;
MATRR;
This is a CMO Composite Average:
(((CMO(C,5))+(CMO(C,10))+(CMO(C,20)))/3)
This is CMO Volatility:
S1:= Stdev( CMO(C,5),5);
S2:= Stdev(CMO(C,10),10);
S3:= Stdev(CMO(C,20),20);
CMOV:=(S1*CMO(C,5))+(S2*CMO(C,10))+(S3*CMO(C,20))/(S1+S2+S3);
CMOV;
This is Rule of 7 down objective:
If((ROC(C,12,%)>-1.5),If((ROC(C,12,%)>-3),
If((ROC(C,12,%)>-4.5),((H-(H-L)*1.75)),((H-(H-L)*2.33))),((H-(H-L)*3.5))),(H-(H-L)))
This is rule of 7 up objective:
If((ROC(C,12,%)>1.5),If((ROC(C,12,%)>3),
If((ROC(C,12,%)>4.5),(((H-L)*1.75)+L),(((H-L)*2.33)+L)),(((H-L)*3.5)+L)),((H-L)+L))
This is rule of 7 Osc:
Fml("Rule of 7 UP Objective") -
Fml("Rule of 7 DOWN Objective")
This is %f Osc:
100*((C-Ref(TSF(C,5),-1))/C)
This is Chande's Trendscore:
If(C>=Ref(C,-11),1,-1)+If(C>=Ref(C,-12),1,-1)+If(C>=Ref(C,-13),1,-1)+
If(C>=Ref(C,-14),1,-1)+If(C>=Ref(C,-15),1,-1)+If(C>=Ref(C,-16),1,-1)+
If(C>=Ref(C,-17),1,-1)+If(C>=Ref(C,-18),1,-1)+If(C>=Ref(C,-19),1,-1)+
If(C>=Ref(C,-20),1,-1)
This is McGinley Dynamic:
Ref(Mov(C,12,E),-1)+((C-(Ref(Mov(C,12,E),-1))) /
(C/(Ref(Mov(C,12,E),-1))*125))
This is Morris Double Momentum Osc:
Mov(((ROC(C,12.8,%))+(ROC(C,19.2,%))),10,W)
This is Volatility%:
Lookback := Input("Time Periods",1,1000,50);
HighVolatility := Input("High Volatility %",.01,100,3);
100 * Sum(100 * ATR(1)/CLOSE > HighVolatility, Lookback)/Lookback
This is Positive Volume Indicator:
Cum(If(V>Ref(V,-1),ROC(C,1,%),0))
This is negative volume indicator:
Cum(If(V<Ref(V,-1),ROC(C,1,%),0))
Candle Code
From "Lyn Maine"
Here is the formula from this months TASC called Candle code
this is only using 1 formula not like the one in TASC which is
broken up into several smaller ones.
CandleCode
Bdy:=Abs(O-C);
Lshd:=If(C>=O,O-L,C-L);
Ushd:=If(C>=O,H-C,H-O);
ThBotB:=BBandBot(Bdy,55,E,0.5);
ThTopB:=BBandTop(Bdy,55,E,0.5);
ThBotL:=BBandBot(Lshd,55,E,0.5);
ThTopL:=BBandTop(Lshd,55,E,0.5);
ThBotU:=BBandBot(Ushd,55,E,0.5);
ThTopU:=BBandTop(Ushd,55,E,0.5);
CCode:=If(C=O,1,0)*If(Ushd>=Lshd,64,48)+If(C=O,0,1)*(If(C>O,1,0)*(If(Bdy<=ThBotB,80,0)+If(Bdy>ThBotB
AND Bdy<=ThTopB,96,0)+ If(Bdy>ThTopB,112,0))+
If(C<O,1,0)*(If(Bdy<=ThBotB,32,0)+ If(Bdy>ThBotB AND
Bdy<=ThTopB,16,0)))+(If(Lshd=0,3,0)+ If(Lshd<ThBotL AND Lshd>0,2,0)+
If(Lshd>ThBotL AND Lshd<=ThTopL AND Lshd>0,1,0))+(If(Ushd>0 AND
Ushd<=ThBotU,4,0)+ If(Ushd>ThbotU AND Ushd<=ThTopU,8,0)+
If(Ushd>ThTopU,12,0));
CCode;
CSI{Candle strength index}
Periods:=Input("Enter Periods",2,13,2);
Mov(Mov(Mov(Fml("Candlecode"),Periods,S),Periods,S),Periods,S)
My
version of Tushar Chande's Vidya using the P variable
Vidya{P}
Periods:=Input("length of MA",5,100,20);
K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);
A:=(2/(Periods+1));
Vidya:=A*K*(P)+(1-A*K)*Ref(P,-1);
Vidya;
Tar(SZ)an Long
C-(((462*Mov(C,34,E))-(420*Mov(C,13,E))+(490*(Mov(Mov(C,13,E)-Mov(C,34,E),89,E))))/42)
Tar(SZ)an Short
(C-(((325*Mov(C,26,E))-(297*Mov(C,12,E))+(351*Mov(Mov(C,13,E)-Mov(C,26,E),9,E))))/28)*2
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(TD7,-1) + Ref(TD7,-2) + Ref(TD7,-3) +
Ref(TD7,-4)*100;
TDREI;
|