logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

3 Pages<123>
Options
Go to last post Go to first unread
dieselpr  
#21 Posted : Thursday, September 1, 2005 1:11:07 AM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Quick question has anyone tried to back test the simply version of this divergence formula? I tried to do a points only backtest on the formula only using the sell shorts but I got no results. I also tried the long buy side of the formula and it work pretty good. Anyone else not getting any results with Jose simpified version of the sell formula? I double check it 3 times with no luck.
dieselpr  
#22 Posted : Thursday, September 1, 2005 1:19:41 AM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Sorry I forgot to post the code I used- {sell} PkPer:=OPT1; pds1:=OPT2; pds2:=(OPT2*2); pds3:=(OPT2*3); x:=Ult(pds1,pds2,pds3); pk1:=Peak(1,x,PkPer); pk2:=Peak(2,x,PkPer); pk3:=Peak(3,x,PkPer); pk4:=Peak(4,x,PkPer); pk5:=Peak(5,x,PkPer); pk6:=Peak(6,x,PkPer); pk7:=Peak(7,x,PkPer); pk8:=Peak(8,x,PkPer); pkHi:=ValueWhen(1,pk1<>Ref(pk1,-1),H); sell:=If(x>Mov(x,9,E) AND x>50 AND (pk1<pk2 AND pk2<>Ref(pk2,-1) AND pkHi>ValueWhen(2,pk2<>Ref(pk2,-1),H) OR pk1<pk3 AND pk3<>Ref(pk3,-1) AND pkHi>ValueWhen(3,pk3<>Ref(pk3,-1),H) OR pk1<pk4 AND pk4<>Ref(pk4,-1) AND pkHi>ValueWhen(4,pk4<>Ref(pk4,-1),H) OR pk1<pk5 AND pk5<>Ref(pk5,-1) AND pkHi>ValueWhen(5,pk5<>Ref(pk5,-1),H) OR pk1<pk6 AND pk6<>Ref(pk6,-1) AND pkHi>ValueWhen(6,pk6<>Ref(pk6,-1),H) OR pk1<pk7 AND pk7<>Ref(pk7,-1) AND pkHi>ValueWhen(7,pk7<>Ref(pk7,-1),H) OR pk1<pk8 AND pk8<>Ref(pk8,-1) AND pkHi>ValueWhen(8,pk8<>Ref(pk8,-1),H)),-1,0); sell;
billtrudeau  
#23 Posted : Thursday, September 1, 2005 1:56:29 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

I have liked divergences for a long time. I recently got interested in setting up experts and exploration because I have noticed that certain stocks do particularly well with divergences of certain indicators. For instance, you could use RSI, MACD, Ultimate Oscillator or any of the numerous others out there. I have been trading certain stocks for 10 -15 years and have really studied them over the years. About a year ago I noticed that when one of my favorite stocks to trade diverged with a particular indicator it gave good buy or sell signals for each of the previous ten signals. Exiting the trade may need to rely on another indicator for exit because you don't always get a divergence exit associated with the divergence entry. That same indicator might not give signals as frequently with another stock but usually that indicator divergence signal, when it does occur, is tradeable. So my interest is in developing explorers that give me a basket of stocks to chart and visually observe the divergence. All divergences are not created equally. For this reason I don't think that this system can be optimized as you suggest. I do play around with the moving average values, whether to use the high/low or close, as well as the variables used to define the peak or trough. I have experts and explorers that look at many of these variables. Recently a stock I follow did not produce a buy using the high/low data values but when I looked at the stock chart, I noticed that there was a divergence if you used the closing values. A few days later, the stock gave a buy based upon the high/low data but using the close data a few days earlier resulted in getting into the stock before a 10% runup had occurred. I would recommend trying different indicators and then using the chart to confirm that the indicator defined divergence is worthy. I am constantly working to improve the filters on the indicator but it becomes increasingly more difficult because I have so many variations on the theme in my indicator files and sometimes have trouble remembering which stage of development each indicator is at. I really think that divergences are in the top tier of indicators. Maybe someday I will be half as proficient as Jose is at writing code. Maybe then I can take long summer vacations as I had planned to do when I was a much younger man.
dieselpr  
#24 Posted : Thursday, September 1, 2005 1:55:45 PM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Thanks billtrudeau but maybe I didn't ask the question correctly. I used the first long entry formula that was simplified by Jose in a back test with OPT and it worked fine. I then tried the sell entry signal for shorting stock but it didn't show any results. I used both of them as entry signal for shorting and buying during the back test not as exit signal. My question was- Did anyone else back test the sell signal as an entry for shorting stock and get no results also? I can plot the formula on a chart but I can't get any results during a backtest and I can't figure out why not.
Jose  
#25 Posted : Thursday, September 1, 2005 7:14:52 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
BillTrudeau, that's a good explanation of some of the issues involved in divergence - thanks for sharing your thoughts. :) Dieselpr, take care when backtesting the currently posted divergence formula, as it uses peak/trough functions which give signals in hindsight. jose '-) http://www.metastocktool...om/MACDH/MACDHdiverg.htm .
dieselpr  
#26 Posted : Friday, September 2, 2005 12:36:49 AM(UTC)
dieselpr

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 130

Thanks Jose, But every formula that I have seen about divergence in metastock has alway came back and encoded it using the same method. I have read tons of users that hate the zigzag function because of that fact. I normally stay away from the function also but this was the first time I saw it used in this way with the ultimate oscillator. Is there any better way to get divergence inside of metastock? I've seen the one on your website and the one in the training section of this group. Both of which use the trough and peaks function.
Jose  
#27 Posted : Friday, September 2, 2005 4:10:36 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
dieselpr wrote:
Is there any better way to get divergence inside of metastock?
I don't know of a better way than the MACDH Divergence kit.
dieselpr wrote:
I've seen the one on your website and the one in the training section of this group. Both of which use the trough and peaks function.
Neither the free divergence indicator version at http://www.metastocktool...MetaStock/Divergence.txt nor the MACDH Divergence kit, use any hindsight-based peak or trough functions. jose '-) http://www.metastocktool...om/MACDH/MACDHdiverg.htm .
billtrudeau  
#28 Posted : Saturday, September 3, 2005 1:21:50 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Jose, Have you tried other indicators in your MACDH Divergence kit? If so, and one purchases your package, can it be modified for other indicators?
Jose  
#29 Posted : Saturday, September 3, 2005 3:06:55 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
BillTrudeau, to answer your questions, I've spent a rather long time researching & testing divergence between price and other indicators/oscillators, but I've yet to find anything that gives such a favourable ratio of good-to-failed signals, as with divergence between price and standard MACD Histogram. There are other divergences between related markets that look promising (specially when trading related commodities), but for general divergences I would have to agree with Dr Alexander Elder that the MACDH is a great divergence indicator by virtue of its properties. As with all my work (free or otherwise), the MACDH kit comes with all its code openly visible, and structured in a modular fashion so that the MACDH can be easily replaced by any other oscillator/indicator. The kit even includes an experimental set of indicators and templates just for this purpose. jose '-) http://www.metastocktool...om/MACDH/MACDHdiverg.htm .
billtrudeau  
#30 Posted : Friday, September 30, 2005 3:28:13 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

I am trying to add a filter that will eliminate a peak or trough if there is an intermediate peak or trough that fell on the other side of the trendline connecting the two peaks or troughs. For instance, if the indicator had a low 2 months ago and a higher low recently but there was a low that occurred below the trendline connecting the 2 month ago and present low, I would not want to consider this a valid signal. A way to test this is to make sure that the slope of the line connecting the 2 month ago low to each successive data point is steeper than the slope of the trendline. Obviously if the slope is flatter, we had a lower intermediate trough. For the experts out there does this sound like the kind of test that can be written in MetaStock language?
billtrudeau  
#31 Posted : Saturday, March 11, 2006 3:28:13 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

OK, it has been quite some time but I finally have found the time to add the slope filter to the divergence detection formula. The filter is intended to make sure that the slope line connecting the slope x occurrences ago to the most recent trough low contains all of the trough lows in between and the same with the price. The problem. The formula won't fit and so I can't fully test if is doing exactly what I want. Too many variables and maybe too many characters. Can anyone suggest how I might be able to simplify or break the formula into multiple indicators? Thanks for any opinions.
[code:1:1d063acdd5]{Ultimate Oscillator Divergence Buy Low } { Note: first trough is dynamic } { User inputs } TrPer:=Input("Trough %",0,100,15); pds1:=Input("Ultimate periods 1",1,260,7); pds2:=Input("Ultimate periods 2",1,260,14); pds3:=Input("Ultimate periods 3",1,260,28); { Variables } x:=Ult(pds1,pds2,pds3); tr1:=Trough(1,x,TrPer); tr2:=Trough(2,x,TrPer); tr3:=Trough(3,x,TrPer); tr4:=Trough(4,x,TrPer); tr5:=Trough(5,x,TrPer); tr6:=Trough(6,x,TrPer); tr7:=Trough(7,x,TrPer); tr8:=Trough(8,x,TrPer); trLo:=ValueWhen(1,tr1<>Ref(tr1,-1),L); { Determine number of bars since indicated trough} tb1:= TroughBars(1,x,TrPer); tb2:= TroughBars(2,x,TrPer); tb3:= TroughBars(3,x,TrPer); tb4:= TroughBars(4,x,TrPer); tb5:= TroughBars(5,x,TrPer); tb6:= TroughBars(6,x,TrPer); tb7:= TroughBars(7,x,TrPer); tb8:= TroughBars(8,x,TrPer); { Determine slope of line connecting referenced indicator trough to most recent trough} slpt21:=(tr2-tr1)/(tb2-tb1); slpt31:=(tr3-tr1)/(tb3-tb1); slpt41:=(tr4-tr1)/(tb4-tb1); slpt51:=(tr5-tr1)/(tb5-tb1); slpt61:=(tr6-tr1)/(tb6-tb1); slpt71:=(tr7-tr1)/(tb7-tb1); slpt81:=(tr8-tr1)/(tb8-tb1); { Determine slope of price lows corresponding to indicator trough} slpl21:=-(ValueWhen(2,tr1<>Ref(tr1,-1),L)-trLo)/(tb2-tb1); slpl31:=-(ValueWhen(3,tr1<>Ref(tr1,-1),L)-trLo)/(tb3-tb1); slpl41:=-(ValueWhen(4,tr1<>Ref(tr1,-1),L)-trLo)/(tb4-tb1); slpl51:=-(ValueWhen(5,tr1<>Ref(tr1,-1),L)-trLo)/(tb5-tb1); slpl61:=-(ValueWhen(6,tr1<>Ref(tr1,-1),L)-trLo)/(tb6-tb1); slpl71:=-(ValueWhen(7,tr1<>Ref(tr1,-1),L)-trLo)/(tb7-tb1); slpl81:=-(ValueWhen(8,tr1<>Ref(tr1,-1),L)-trLo)/(tb8-tb1); { Condition } buy:= x<Mov(x,9,E) AND x<50 AND (tr1>tr2 AND tr2<>Ref(tr2,-1) AND trLo<ValueWhen(2,tr2<>Ref(tr2,-1),L) OR tr1>tr3 AND tr3<>Ref(tr3,-1) AND trLo<ValueWhen(3,tr3<>Ref(tr3,-1),L) {Add condition that slope of tr3 to trLo is steeper than slope of tr2 to trLo and slope of price L at tr3 to price L at trLo is flatter than slope of price at tr2 to price L at trLo} AND slpt31>= slpt21 AND slpl31>= slpl21 OR tr1>tr4 AND tr4<>Ref(tr4,-1) AND trLo<ValueWhen(4,tr4<>Ref(tr4,-1),L) {Add condition that slope of tr4 to trLo is steeper than all previous slopes and slope of price L at tr4 to price L at trLo is flatter than all previous slopes} AND slpt41>= (slpt31 AND slpt21) AND slpl41>= (slpl31 AND slpl21) OR tr1>tr5 AND tr5<>Ref(tr5,-1) AND trLo<ValueWhen(5,tr5<>Ref(tr5,-1),L) {Add condition that slope of tr5 to trLo is steeper than all previous slopes and slope of price L at tr5 to price L at trLo is flatter than all previous slopes} AND slpt51>= (slpt41 AND slpt31 AND slpt21) AND slpl51>= (slpl41 AND slpl31 AND slpl21) OR tr1>tr6 AND tr6<>Ref(tr6,-1) AND trLo<ValueWhen(6,tr6<>Ref(tr6,-1),L) {Add condition that slope of tr6 to trLo is steeper than all previous slopes and slope of price L at tr6 to price L at trLo is flatter than all previous slopes} AND slpt61>= (slpt51 AND slpt41 AND slpt31 AND slpt21) AND slpl61>= (slpl51 AND slpl41 AND slpl31 AND slpl21) OR tr1>tr7 AND tr7<>Ref(tr7,-1) AND trLo<ValueWhen(7,tr7<>Ref(tr7,-1),L) {Add condition that slope of tr7 to trLo is steeper than all previous slopes and slope of price L at tr7 to price L at trLo is flatter than all previous slopes} AND slpt71>= (slpt61 AND slpt51 AND slpt41 AND slpt31 AND slpt21) AND slpl71>= (slpl61 AND slpl51 AND slpl41 AND slpl31 AND slpl21) OR tr1>tr8 AND tr8<>Ref(tr8,-1) AND trLo<ValueWhen(8,tr8<>Ref(tr8,-1),L)) {Add condition that slope of tr8 to trLo is steeper than all previous slopes and slope of price L at tr8 to price L at trLo is flatter than all previous slopes} AND slpt81>= (slpt71 AND slpt61 AND slpt51 AND slpt41 AND slpt31 AND slpt21) AND slpl81>= (slpl71 AND slpl61 AND slpl51 AND slpl41 AND slpl31 AND slpl21); { Plot Long divergence signals in own window } -buy[/code:1:1d063acdd5]
Jose  
#32 Posted : Saturday, March 11, 2006 5:53:59 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
The formula is too big for MetaStock - you'll need to split it. jose '-)
billtrudeau  
#33 Posted : Saturday, March 11, 2006 7:47:02 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Thanks, My next project, after I finish my income taxes.
billtrudeau  
#34 Posted : Friday, March 17, 2006 1:54:09 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

I have broken the formula into three formulas. However, the first formula is still to big. There is a limit of 2500 characters per formula, which includes spaces. In order to evaluate if I can delete spaces, I need to know what MS considers a space. Is a space just the space between characters, or does it count a blank line as so many blank spaces and does it assign blank spaces to the remainder of a line when using carriage returns? Based upon the number of characters and spaces between the characters, I think that I should be well below the limit. However, I will confess that I did not try to count all 2500 characters. MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formulae between "---8<---" lines. ===============================. Ultimate Oscillator Divergence Buy Low =============================== ---8<------------------------------------ {Ultimate Oscillator Divergence Buy Low } { Note: first trough is dynamic } { User inputs } TrPer:=Input("Trough %",0,100,15); pds1:=Input("Ultimate periods 1",1,260,7); pds2:=Input("Ultimate periods 2",1,260,14); pds3:=Input("Ultimate periods 3",1,260,28 ); { Variables } x:=Ult(pds1,pds2,pds3); tr1:=Trough(1,x,TrPer); tr2:=Trough(2,x,TrPer); tr3:=Trough(3,x,TrPer); tr4:=Trough(4,x,TrPer); tr5:=Trough(5,x,TrPer); tr6:=Trough(6,x,TrPer); tr7:=Trough(7,x,TrPer); tr8:=Trough(8,x,TrPer); trLo:=ValueWhen(1,tr1<>Ref(tr1,-1),L); { Condition } buy:= x<Mov(x,9,E) AND x<50 AND (tr1>tr2 AND tr2<>Ref(tr2,-1) AND trLo<ValueWhen(2,tr2<>Ref(tr2,-1),L) OR tr1>tr3 AND tr3<>Ref(tr3,-1) AND trLo<ValueWhen(3,tr3<>Ref(tr3,-1),L) {Add condition that slope of tr3 to trLo is steeper than slope of tr2 to trLo and slope of price L at tr3 to price L at trLo is flatter than slope of price at tr2 to price L at trLo} AND fmlvar(“Div TLS”,”slpt31”)>= fmlvar(“Div TLS”,”slpt21”) AND fmlvar(“Div TLS”,”slpl31”)>= fmlvar(“Div TLS”,”slpl21”) OR tr1>tr4 AND tr4<>Ref(tr4,-1) AND trLo<ValueWhen(4,tr4<>Ref(tr4,-1),L) {Add condition that slope of tr4 to trLo is steeper than all previous slopes and slope of price L at tr4 to price L at trLo is flatter than all previous slopes} AND fmlvar(“Div TLS”,”slpt41”)>= (fmlvar(“Div TLS”,”slpt31”) AND fmlvar(“Div TLS”,”slpt21”)) AND fmlvar(“Div TLS”,”slpl41”)>= (fmlvar(“Div TLS”,”slpl31”) AND fmlvar(“Div TLS”,”slpl21”)) OR tr1>tr5 AND tr5<>Ref(tr5,-1) AND trLo<ValueWhen(5,tr5<>Ref(tr5,-1),L) {Add condition that slope of tr5 to trLo is steeper than all previous slopes and slope of price L at tr5 to price L at trLo is flatter than all previous slopes} AND fmlvar(“Div TLS”,”slpt51”)>= (fmlvar(“Div TLS”,”slpt41”) AND fmlvar(“Div TLS”,”slpt31”) AND fmlvar(“Div TLS”,”slpt21”)) AND fmlvar(“Div TLS”,”slpl51”)>= (fmlvar(“Div TLS”,”slpl41”) AND fmlvar(“Div TLS”,”slpl31”) AND fmlvar(“Div TLS”,”slpl21”)) OR tr1>tr6 AND tr6<>Ref(tr6,-1) AND trLo<ValueWhen(6,tr6<>Ref(tr6,-1),L) {Add condition that slope of tr6 to trLo is steeper than all previous slopes and slope of price L at tr6 to price L at trLo is flatter than all previous slopes} AND fmlvar(“Div TLS”,”slpt61”)>= (fmlvar(“Div TLS”,”slpt51”) AND fmlvar(“Div TLS”,”slpt41”) AND fmlvar(“Div TLS”,”slpt31”) AND fmlvar(“Div TLS”,”slpt21”)) AND fmlvar(“Div TLS”,”slpl61”)>= (fmlvar(“Div TLS”,”slpl51”) AND fmlvar(“Div TLS”,”slpl41”) AND fmlvar(“Div TLS”,”slpl31”) AND fmlvar(“Div TLS”,”slpl21”)) OR tr1>tr7 AND tr7<>Ref(tr7,-1) AND trLo<ValueWhen(7,tr7<>Ref(tr7,-1),L) {Add condition that slope of tr7 to trLo is steeper than all previous slopes and slope of price L at tr7 to price L at trLo is flatter than all previous slopes} AND fmlvar(“Div TLS”,”slpt71”)>= (fmlvar(“Div TLS”,”slpt61”) AND fmlvar(“Div TLS”,”slpt51”) AND fmlvar(“Div TLS”,”slpt41”) AND fmlvar(“Div TLS”,”slpt31”) AND fmlvar(“Div TLS”,”slpt21”)) AND fmlvar(“Div TLS”,”slpl71”)>= (fmlvar(“Div TLS”,”slpl61”) AND fmlvar(“Div TLS”,”slpl51”) AND fmlvar(“Div TLS”,”slpl41”) AND fmlvar(“Div TLS”,”slpl31”) AND fmlvar(“Div TLS”,”slpl21”)) OR tr1>tr8 AND tr8<>Ref(tr8,-1) AND trLo<ValueWhen(8,tr8<>Ref(tr8,-1),L)) {Add condition that slope of tr8 to trLo is steeper than all previous slopes and slope of price L at tr8 to price L at trLo is flatter than all previous slopes} AND fmlvar(“Div TLS”,”slpt81”)>= (fmlvar(“Div TLS”,”slpt71”) AND fmlvar(“Div TLS”,”slpt61”) AND fmlvar(“Div TLS”,”slpt51”) AND fmlvar(“Div TLS”,”slpt41”) AND fmlvar(“Div TLS”,”slpt31”) AND fmlvar(“Div TLS”,”slpt21”)) AND fmlvar(“Div TLS”,”slpl81”)>= (fmlvar(“Div TLS”,”slpl71”) AND fmlvar(“Div TLS”,”slpl61”) AND fmlvar(“Div TLS”,”slpl51”) AND fmlvar(“Div TLS”,”slpl41”) AND fmlvar(“Div TLS”,”slpl31”) AND fmlvar(“Div TLS”,”slpl21”)); { Plot Long divergence signals in own window } -buy ---8<------------------------------------ ===============================. Div TB =============================== ---8<------------------------------------ { Determine number of bars since indicated trough} x:=fmlvar(“Ultimate Oscillator Divergence Buy Low”,”x”); tb1:= TroughBars(1,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb2:= TroughBars(2,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb3:= TroughBars(3,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb4:= TroughBars(4,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb5:= TroughBars(5,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb6:= TroughBars(6,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb7:= TroughBars(7,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); tb8:= TroughBars(8,x, fmlvar(” Ultimate Oscillator Divergence Buy Low”,”TrPer”)); ---8<------------------------------------
billtrudeau  
#35 Posted : Saturday, March 18, 2006 12:54:15 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

The rest of the third formula. ===============================. Div TLS =============================== ---8<------------------------------------ { Determine slope of line connecting referenced indicator trough to most recent trough} tr1:=fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr1”) trLo:=fmlvar(“Ultimate Oscillator Divergence Buy Low”,”trLo”) tb1:=fmlvar(“Div TB”,”tb1”) slpt21:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr2”)- tr1)/( fmlvar(“Div TB”,”tb2”)-tb1); slpt31:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr3”)- tr1)/( fmlvar(“Div TB”,”tb3”)-tb1); slpt41:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr4”)- tr1)/( fmlvar(“Div TB”,”tb4”)-tb1); slpt51:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr5”)- tr1)/( fmlvar(“Div TB”,”tb5”)-tb1); slpt61:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr6”)- tr1)/( fmlvar(“Div TB”,”tb6”)-tb1); slpt71:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr7”)- tr1)/( fmlvar(“Div TB”,”tb7”)-tb1); slpt81:=( fmlvar(” Ultimate Oscillator Divergence Buy Low”,”tr8”)- tr1)/( fmlvar(“Div TB”,”tb8”)-tb1); { Determine slope of price lows corresponding to indicator trough} slpl21:=-(ValueWhen(2, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb2”)-tb1); slpl31:=-(ValueWhen(3, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb3”)-tb1); slpl41:=-(ValueWhen(4, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb4”)-tb1); slpl51:=-(ValueWhen(5, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb5”)-tb1); slpl61:=-(ValueWhen(6, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb6”)-tb1); slpl71:=-(ValueWhen(7, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb7”)-tb1); slpl81:=-(ValueWhen(8, tr1<>Ref(tr1,-1),L)-trLo)/( fmlvar(“Div TB”,”tb8”)-tb1); ---8<------------------------------------
arnevanveen  
#36 Posted : Friday, March 24, 2006 5:38:11 PM(UTC)
arnevanveen

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 10/15/2005(UTC)
Posts: 31
Location: The Netherlands

Interesting formula, but unfortunately too long indeed. I tried to shorten the formula, but it is still too long. I have still around 2600 characters.
billtrudeau  
#37 Posted : Friday, March 24, 2006 5:56:40 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

I have been able to get it below 2500 characters. A few problems that I have run into and still have. First, I put the formulas into Word and copy the formulas to MS. However, when I did this, all of the quotation marks for the formula variable call did not translate into MS. I had to re-enter all of the quotation marks in MS. This is a pain. Does anyone know what the issue with this is? Also, I use the properties function in Word to keep track of the number of characters. Don't know if this is a one to one comparison with how MS defines characters, but it helps. Now the biggest problem to overcome. I have broken out sections of the formula to keep the main formula manageable. Is it possible to reference another formula which in that formula does a formula variable call back to the main formula? Or is this a circular reference that is not permitted? I did this but get an error message in all of the formulas that the variable in the formula variable call does not exist. This is my task for this weekend, see if I can make more progress. As a plug, I subscribed to Roy's newsletter and all of the back issues last week and I highly recommend it. Very well presented and written. I think it will take me about 6 months to get through all of the back issues.
arnevanveen  
#38 Posted : Friday, March 24, 2006 7:00:37 PM(UTC)
arnevanveen

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 10/15/2005(UTC)
Posts: 31
Location: The Netherlands

Sorry, i don't know if you can reference forth and backward to that other formula. I'm now working with your formula on a positive and negative reversal formula (opposite of divergences), but this is allready hard for me. I only have to switch the signals i think and i'm trying, but it is hard. Tomorrow another day. Can you give me the link for that newsletter? Sounds interesting. Everybody a good weekend! Arne
billtrudeau  
#39 Posted : Friday, March 24, 2006 7:14:59 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Jose  
#40 Posted : Saturday, March 25, 2006 12:06:10 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Billtrudeau, never use MS Word for copy & paste of formulae into MetaStock, as it often introduces invisible format characters that interfere with the code. Use Window's Notepad instead. The circular reference problem can be solved with the aid of the GV.dll - ask Roy for more details about this. jose '-)
Users browsing this topic
Guest (Hidden)
3 Pages<123>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.