- Katılım
- 23 Eki 2020
- Mesajlar
- 1,826
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); Signal := Mov(EMAdif,SigPds,E); Histo := EMAdif-Signal; 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: |