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

Notification

Icon
Error

Options
Go to last post Go to first unread
mikrit71  
#1 Posted : Tuesday, May 14, 2013 2:24:59 AM(UTC)
mikrit71

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/9/2013(UTC)
Posts: 4

I think there must be a better way to code the following but can´t figure out how. The idea is to check several more days wich would make this code a really mess..

bWidth:= (BBandTop(C,20,S,2)-BBandBot(C,20,S,2));
bWidth4:= (BBandTop(Ref(C,-4),20,S,2)-BBandBot(Ref(C,-4),20,S,2));
bWidth5:= (BBandTop(Ref(C,-5),20,S,2)-BBandBot(Ref(C,-5),20,S,2));
bWidth6:= (BBandTop(Ref(C,-6),20,S,2)-BBandBot(Ref(C,-6),20,S,2));
bolTop:= BBandTop(C,20,S,2);
bolBot:= BBandBot(C,20,S,2);

minBolWidth:= ATR(21)*4;

crossTop:= bWidth >= minBolWidth
AND Cross(C,bolTop);

crossWidth4:= bWidth4 >= minBolWidth
AND Ref(Cross(C,bolBot),-4);

crossWidth5:= bWidth5 >= minBolWidth
AND Ref(Cross(C,bolBot),-5);

crossWidth6:= bWidth6 >= minBolWidth
AND Ref(Cross(C,bolBot),-6);

crossTop AND crossWidth4
OR
crossTop AND crossWidth5
OR
crossTop AND crossWidth6

wabbit  
#2 Posted : Tuesday, May 14, 2013 6:08:16 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
In words, not code, what specifically are you looking for?


wabbit [:D]

mikrit71  
#3 Posted : Wednesday, May 15, 2013 5:28:44 AM(UTC)
mikrit71

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/9/2013(UTC)
Posts: 4

My idea with this code is to find stocks who has gone from bottom bollingerband to top bollingerband within x days and where bolingerband has a min width at the day the upper bollingerband crosses and also check the min width at the -day where the lower bollingerband crosses for first time since the upper band was crossed.

.
Instead of testing for each day back from the day it crosses the upper bollingerband if it has crosses the bottom bollingerband I would like to use a function like ALERT() where I can put x days and scan back x days instead of using a variable for each day like I do now. Another problem with my code now is that if I want to scan 20 days back the system wont allow me to have that many variables.

I cant understand how to monitor the first -day who crosses the lower bollingerband and from there check that days width between upper and lower bollingerband with a simpler method.

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.