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

Notification

Icon
Error

Options
Go to last post Go to first unread
daiwa  
#1 Posted : Monday, September 18, 2006 7:58:21 AM(UTC)
daiwa

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/27/2006(UTC)
Posts: 16
Location: Finland

I found this code from here, which works just fine, either I didn´t quite get an idea why a manually ask from the history when high/low has occured where retracements are calculated. How should I change the code to plot automatically highest high ie. during 2006 from individual stock and them draw retracemetn lines like 0.318, 0.50, 0.618, 1,38, 1,618 etc. ?


Best Regards,

e-mail: intersil@gmail.com

- D



Code:

highdate:=Input("high date mmddyyyy",111990,12312100,4032006);
lowdate:=Input("low date mmddyyyy",111990,12312100,1042006);


a:=ValueWhen(1,highDate=Month()*1000000 + DayOfMonth()*10000+ Year(),H);

aa:=ValueWhen(1, lowDate=Month()*1000000 + DayOfMonth()*10000+ Year(),L);

aaa:=a-aa;
aaaa:=aa+(aaa*.5);


a;
aa;
aaaa;
If(L<aaaa AND H>aaaa, aa +1,aa);

Code:


highdate:=Input("high date mmddyyyy",111990,12312100,4032006);
lowdate:=Input("low date mmddyyyy",111990,12312100,1042006);


a:=ValueWhen(1,highDate=Month()*1000000 + DayOfMonth()*10000+ Year(),H);

aa:=ValueWhen(1, lowDate=Month()*1000000 + DayOfMonth()*10000+ Year(),L);

aaa:=a-aa;
aaaa:=aa+(aaa*.5);

L<aaaa AND H>aaaa;

hayseed  
#2 Posted : Tuesday, September 19, 2006 1:55:44 AM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey diawa..... just a quick response here.... one reason for manual date inputs is to focus the fib lines to some very particular period in time..... its similar to the meta fibonccia tool itself, except here we can use the lines reference buys/sells..... as an example , in your provided code you can see the trigger when the 50% line is crossed....

rewrite the code to manually vary lines as below....h

===========================================

highdate:=Input("high date mmddyyyy",111990,12312100,1122006);
lowdate:=Input("low date mmddyyyy",111990,12312100,7142006);
b:=Input(".236",.01,2,.236);
bb:=Input("..382",.01,2,.382);
bbb:=Input(".50",.01,2,.50);
bbbb:=Input(".618",.01,2,.618);

a:=ValueWhen(1,highDate=Month()*1000000 + DayOfMonth()*10000+ Year(),H);

aa:=ValueWhen(1, lowDate=Month()*1000000 + DayOfMonth()*10000+ Year(),L);

aaa:=(b*(a-aa))+aa;
aaaa:=(bb*(a-aa))+aa;
aaaaa:=(bbb*(a-aa))+aa;
aaaaaa:=(bbbb*(a-aa))+aa;

a;aa;aaa;aaaa;aaaaa;aaaaaa;

==============================================

hayseed  
#3 Posted : Tuesday, September 19, 2006 2:26:57 AM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

a second thought reguarding the during 2006 would be the code below....

fib fines can also be ploted in an adapting manner.... by that i mean as long as the highest and lowest stand, the fib lines will stay horizontal in the standard manner but if the low goes lower or high goes higher, the lines will adjust to todays new low but the historical lines will still have the original plot....

so there you have both the horistorical and current lines.....h

must be overlayed without scale to work

====================================

b:=Input(".236",.01,2,.236);
bb:=Input("..382",.01,2,.382);
bbb:=Input(".50",.01,2,.50);
bbbb:=Input(".618",.01,2,.618);
bbbbb:=Input("when applying, always choose overlay without scale",0,0,0);
m:=1;
d:=3;
y:=2006;

a:=ValueWhen(1, Month()=m AND DayOfMonth()=d AND Year()=y,Ref(C,-1));
aa:=ValueWhen(1, Month()=m AND DayOfMonth()=d AND Year()=y,O);

aaa:=(b*(a-aa))+aa;
aaaa:=(bb*(a-aa))+aa;
aaaaa:=(bbb*(a-aa))+aa;
aaaaaa:=(bbbb*(a-aa))+aa;

a;aa;aaa;aaaa;aaaaa;aaaaaa;

=====================================

daiwa  
#4 Posted : Wednesday, September 20, 2006 6:54:05 AM(UTC)
daiwa

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/27/2006(UTC)
Posts: 16
Location: Finland

Thank you Hayseed,

Very recently bought a metastock and now messing with it´s coding language. Reading Formula Primer allready. Your feedback in and renponse in the forum seems to be shining!

Read number of your columns yesterday for a very long time. I do work a lot of with ElliottWave & Fibonacci issues related of U.S EquityMarkets. With GANN Principals not so familiar, still under learning progress why the full moon hits the market down allways ;)

Do you have any books to recommed to read for coding metastock or even own developing own systems with it ? Do you have experience of coding tradestation also, I think the software is getting more and more popular nowdays between the more serious developers ? At least many books are more and more related of TS2000i. What´s your opinion between these 2 software ?

Finally got a point now what did you mean with your original fibonacci code.

Acutally I might have 3 another question regarding the same code.

===============================================================

1)

How should I change the code informing ie. 2 different fib levels ?

I doubled your code including 2005 and 2006 years and received error message

“You have exceeded the maximum the maximum of 6 input promts”

I hope this is not a limit of metastock as I would like to add more

retracements as 1.618, 1.38 etc to the chart.

If splitting them for 2 different indicators, got also error message>


”The indicator is already plotted in the window, plotted anyway?”

However, manually it is possible to draw more Fibonacci price retracements,

so my best guess is it should not be a limitations in the formula builder either.

What I would like to see is>

- 3 Months high/low retracements

- 2006 high/low retracements

- 2005 high/low retracements

- All time /high/low retracements (including ie. both years)

--- Each retracements should be different colours (just to inform end-user which time frame it´s related).

Difficulties with fibonacci retracents is that if you work with EWI technology and also follow very short timeframs like subminuettes, soon you have your chart so full of different retracements that you are completely lost, but I think this good be idea at least to pick up the big pattern drawing points out from there.

===============================================================

2) What would be simple formula to determine

-----------------------------------------------------------------------------------------------------

- Price touched yearly Fibonacci retracement 61.8% ?

- Price touched yearly Fibonacci retracement 61.8% allowing +-5% error marginal ?

(Often prices makes fake fibonacci breakout just to turn back later or sometimes they are just about to touch but turning before)

-----------------------------------------------------------------------------------------------------

-Price has been increasing ie. at least 10 % and touched upper yearly 61.8% fib retracement ?

And as opposite>

- Price has been decreasing ie. at least 10% and touched lower yearly 61.8 % fib retracement ?

-----------------------------------------------------------------------------------------------------

- Price has been decling ie. at least 10% and touched lower 61.8% retracement and turned up at least +5 % ?

And as opposite

- Price has been increasing ie. at least 10% and touched upper 61.8 % retracement and turned down at least -5%?

==================================================================

3)


I did comparison between meta own fibonacci price-indicator code, but were not able to find which command draw/mention actual retracement number´s in the chart after fib-retracements has been created ?

Would be nice to add to your code as well. Simple beauty question would be how to change code mark those fib levels to the chart as numbers also the same way as meta own Fibonacci indocator do ?


You can see what I mean, if I will find the button how to download my Adobe chart in the forum. You can easily see in the chart the famous Head&Shoulders pattern formed very recently which broke itself to the upside. But more important is where HD pattern where created, it retraced made both shoulders between 38.2 and 50% retracements turned head to just to touch 61.8%. Perfect exsample of comparison of EWI & Traditional Pattern formasion, very deep of EWI tech.

Appreciate your feedback,

- Daiwa




hayseed  
#5 Posted : Wednesday, September 20, 2006 8:05:04 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey diawa.... meta has a 6 input limit..... you could use some subtle logic to effectively increase it beyond 6 but still the visable limit is 6....

when you try to plot the same indicator twice in the same window at times you'll get the error message you mentioned.... if on the second indicator you had different values chosen all will plot.... you will have to click the plot it anyway box.... so when you have the second fib indicator just set your addittional values and apply....

there is a point where 1 chart can't hold it all, fib lines get confusing quick...... its likely you'll need to create a layout with a seperate chart for each of your,

- 3 Months high/low retracements

- 2006 high/low retracements

- 2005 high/low retracements

- All time /high/low retracements (including ie. both years)

for the close nearing or crossing a particular fib line it might be best to create and attach a expert to the charts on that layout..... experts are designed for that purpose....

Cross(C,aaaa) close above 50% line


Cross(aaaa,C) close below 50% line

each of your alerts could be coded into the same expert...... and the expert could be attached to each chart in your layout......h

Users browsing this topic
Guest (Hidden)
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.