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

Notification

Icon
Error

Options
Go to last post Go to first unread
jim c  
#1 Posted : Thursday, March 18, 2010 11:01:53 AM(UTC)
jim c

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 2/17/2010(UTC)
Posts: 18

I have a scan in explorer thats works great thanks to some guys on here.(Thx!) In the colums I would like to have the formula ref(c,+1)-ref(o,+1). Can I do this? Im tyring to say if X happens then what are the next days results. I can get the forumla to work as an indicator but when I try to run a scan it says N/A in the column after exploer is ran. I know this would NOT work if you ran it for the most current days data. However if I chose a date in the past it should have that data available.? Maybe? No?

Thanks for your time! Jim

mstt  
#2 Posted : Thursday, March 18, 2010 1:04:00 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

Hi Jim

When you nominate the last date for an exploration all other data is ignored (as if it wasn't present), so a forward reference will return the same N/A result that you get with current data. In the case of an indicator the indicator automatically has access to future data until it tries to calculate on the the last bar. The solution is to change your point of perspective from today looking forward to tomorrow to one of yesterday looking forward to today - if that happend yesterday what happened today? This still won't solve the problem of not being able to read the furture, but by advancing the nominated exploration date by one bar you'll be able to gather all the historical data you need.

Roy

jim c  
#3 Posted : Thursday, March 18, 2010 2:13:24 PM(UTC)
jim c

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 2/17/2010(UTC)
Posts: 18

Wow. I think I get it. I had to read it like 16 times before I think I got it. ha So here is my formula.

{NAME:BBand crossing)
pds:= Input("MA periods",1,9999,20);
dev:= Input("Standard Deviations",1,10,2);
x:= (H+L+C)/3;
y:=BBandBot(x,pds,s,dev);
cross(y,x);

and I think I wanna make it look like this?

{NAME:BBand crossing)
pds:= Input("MA periods",1,9999,20);
dev:= Input("Standard Deviations",1,10,2);
x:=( ref(h,-1)+ref(l,-1)+ref(c,-1))/3;
y:=BBandBot(x,pds,s,dev);
cross(ref(y,-1),ref(x,-1);

Does that look right? Basically run a scan for todays date that will grab YEST data then I can find out how it turned out today? Thanks for taking the time to respond! Jim

EDIT: Then I put in the formula in one of the columns for today c-o ?

mstt  
#4 Posted : Friday, March 19, 2010 12:20:35 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

Hi Jim

The perspective thing can be pretty hard to explain in a text message but it's pretty simple really - never code anything that looks forward. When you have a situation where one element looks forward by one bar, just delay every element by one bar. Let's face it - we don't know what's going to happen tomorrow so lets keep the code from looking into the future too.

At a quick glance your code looks OK. I would use just one Ref() function around Cross() rather than two inside it, but your way will work just as well.

Roy

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.