MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

JD: MACD Histo Red
If your version is earlier than 7.0 (i.e. 6.52 or before), then there are some additional
tricks you might need to use to get these indicators working. Ver 6.5x does allow you to plot more than one line from a single formula, BUT it does NOT allow you to assign different colors to those lines. So, to get around it, you need to:

1) save the formula as it is, but do not plot it directly
2) create one new very simple formula for each of the lines you wish to draw
3) plot those new formulae

Here's an example, based on the code for the "JD: MACD Histo Red"

1) save this code :

JD: MACD Histo Red

FstPds := Input("Fast EMA Pds",3,50,10);
SloPds := Input("Slow EMA Pds",3,50,5);
SigPds := Input("Signal-Line Pds",3,15,5);
LkBk := Input("LookBack Pds for Dots",10,90,40);
SnkP:=Input("Pct of LkBkMax for Dots",.5,10,5);

EMAdif := Mov(C,FstPds,E) - Mov(C,SloPds,E);

Sink := HHV(Abs(Histo),LkBk)*SnkP/100;
Dlta := Histo - Ref(Histo,-1);
Up := If( Dlta > Sink, Histo, 0);
Dn := If( Dlta < -Sink, Histo, 0);

Up := If(Up <> 0, Up, If( Histo -
Ref(LowestSince(1, Up+Dn<>0, Histo),-1)
> Sink, Histo, 0));
Dn := If(Dn <> 0, Dn, If( Histo -
Ref(HighestSince(1, Up+Dn<>0, Histo),-1)
< -Sink, Histo, 0));

Histo; {thick dk.red bar}
Up; {thick green dot}
Dn; {thick red dot}
0 {thick dk.gray dot}

2) create four new indicators for each of the four plots, each with only one line of code, that simply accesses one of the main routine's variables, and plots it directly:

JD: MACD Histo Red - Histo
==========================
FmlVar("JD: MACD Histo Red","Histo")

JD: MACD Histo Red - UpDot
==========================
FmlVar("JD: MACD Histo Red","Up")

JD: MACD Histo Red - 0-Dot
==========================
FmlVar("JD: MACD Histo Red","Dn")

JD: MACD Histo Red - Histo
==========================
0

3) Now drag each of these four new indicators onto the screen, one at a time, and apply the correct color and line style and line width. Voila!

JD: MACD

{JD: MACD Histo Red - Histo}
FmlVar("JD: MACD Histo Red","Histo");

{JD: MACD Histo Red - UpDot}
FmlVar("JD: MACD Histo Red","Up");

{JD: MACD Histo Red - 0-Dot}
FmlVar("JD: MACD Histo Red","Dn");

{JD: MACD Histo Red - Histo}
0;

Source / From: TOP
Equismetastock[at]yahoogroups[dot]com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!