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

Notification

Icon
Error

Options
Go to last post Go to first unread
ifiaas  
#1 Posted : Saturday, February 3, 2007 10:35:39 AM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

Hi friends, I want to plot a function over a range of closing price from day x to current day. However I found the following feature inconvient: (1) the input (x) has to be key in using a dialogue; (2) the caculated line contains continuous points on each date on the plots, but I hope to show lines only from date x until today.

So here comes my questions: (1) is there a way to input by mouse click? I did a search, it seems it is not possible? (2) is there a way that can hide the trend line before date x?

To (2), if there isn't, I can set the value for those date to a fixed one, so it becomes easy to discriminate. But setting them to 0 (or any other one) is not a good idea, as when I zoom in/out, the plot becomes ugly. I hope I can set the value to the "highest (or lowest) of prices during the date that are shown in the zoomed window". What can I do?

Thank you!

hayseed  
#2 Posted : Saturday, February 3, 2007 8:03:04 PM(UTC)
hayseed

Rank: Advanced Member

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

hey ifiaas.... most of your post i could not clearly understand.... as far as the hide the trend line before date x that can be obtained by including a date component in the code... here is a post where some of the better coders , henry, roy, jose, wabbit, talked of the differing methods....

below is a example of that code.....

now for the parts i didnt understand.... by plot the some function are you meaning the sum function ...... and if so, are you summing 1 security closing prices or many.... h

summing volume from a certain date

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

pnt:=Input("close=1, high=2, low=3",1,5,1);
pds1:=Input("fast macd periods 1",2,100,5);
pds2:=Input("slow macd periods 2",3,100,9);
pds3:=Input("moving average trigger periods 3",2,100,3);

m:=Input("month",1,12,1);
d:=Input("day",1,31,3);
{y:=Input("year",1990,2010,2006);}

0;
upv:=Cum(If(If(pnt=2,H,If(pnt=3,L,C))>Ref((If(pnt=2,H,If(pnt=3,L,C))),-1),V,0));
dnv:=Cum(If((If(pnt=2,H,If(pnt=3,L,C)))<Ref((If(pnt=2,H,If(pnt=3,L,C))),-1),V,0));
a:=upv-dnv;
aa:=ValueWhen(1, Month()=m AND DayOfMonth()=d AND Year()=2005,a);

aaa:=a-aa;

b:=Mov(aaa,pds1,W)-Mov(aaa,pds2,W);

bb:=Mov(b,pds3,W);

b;bb

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

ifiaas  
#3 Posted : Saturday, February 3, 2007 10:47:28 PM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

Thank you Hayseed,

Going through the reference posts, I found that we can limit the range of my plot by calling the Ref() function. However after reading the manual of Ref() function and several trial on my own plot, I can't make it work as I wanted.

According to the manual, Ref(plot, -period) should draw the curve of "plot" from "period" days ago until the current day. That's exactely what I want. However, when I write the following code, hoping to draw the close price in the latest 388 days:

pds:= 488 - 100;
Ref(Close,-pds);

I find that it draws a period of length 100 (instead of 388 which I expected). And the displayed curve is a offset-moved version of the first 100 (from 0 to 100) closing price, instead of the last chunk.

Sorry for confusion, my English sucks.

ifiaas  
#4 Posted : Saturday, February 3, 2007 11:43:32 PM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

I see my mistake. Ref(Close,100) shift the plot to left for 100 period. Ref(Close,-100) shift the plot to the right for 100 period. So when I want to show Close curve from 100 to today I should do the following:

Ref(Ref(Close,100),-100)

Thank you, friends.

ifiaas  
#5 Posted : Wednesday, February 7, 2007 8:52:06 AM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

I was wrong!!!

Ref(Ref(Close,100),-100) doesn't solve my problem. I need to remove the Close plot during day 0~100. And yes, the above function call did it, and plot a curve I expecteed.

However, now, after several days, I find that the old Close curve which WAS correct several days ago shifted!!! It starts, say, from day 105 to today, instead of from 100.

Why is this happening?

Tons of thanks!

hayseed  
#6 Posted : Wednesday, February 7, 2007 10:12:47 AM(UTC)
hayseed

Rank: Advanced Member

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

hey ifiaas.... that ref code did look funny to me but when you said it worked i figured i had no clue as to what your doing....

Ref(Close,-100); , will plot the closing prices shifted 100 bars/days to the right.... so the closing price plotted today by the indicator is the actual closing price from 100 bars/days ago.... if you scrolled back in time to the very first bar on your chart you'll see the indicator did not plot anything for the first 100 days.... the indicator is just shifting the plot to the right...... it removes the last true 100 days.....

that might not be what your after.... people sometime use shifted plots to predict seasonal patterns.... similar to the adage, 'sell in may and go away'.... if we plotted the 'qqqq' with prices offset , we might see the downturn coming......h

Jose  
#7 Posted : Wednesday, February 7, 2007 11:56:28 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)
ifiaas wrote:
I was wrong!! Ref(Ref(Close,100),-100) doesn't solve my problem.
It should work - the formula will always nullify the first 100 bars of data, and will not shift with time. There must be another source for this confusion. jose '-)
hayseed  
#8 Posted : Wednesday, February 7, 2007 2:00:21 PM(UTC)
hayseed

Rank: Advanced Member

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

Ref(Ref(Close,100),-100) ???

hey jose..... sure sounds funny to ask this but are you sure about that..... i might be overlooking something but that looks like it's shifting 100 to the left only to shift 100 back to the right..... so you end up back where you started..... kinda like shifting back from 100 days into the future....

seems like Ref(CLOSE,-100) would remove 100 bars......h

Jose  
#9 Posted : Wednesday, February 7, 2007 3:16:14 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)
Ref(Ref(Close,100),-100) removes the first 100 bars. Ref(Close,-100) only delays Close by 100 bars. Plot it and try it - seeing is believing. ;) jose '-)
hayseed  
#10 Posted : Wednesday, February 7, 2007 5:42:02 PM(UTC)
hayseed

Rank: Advanced Member

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

obviously i have no clue as to the goal here....

Ref(Close,-100) only delays Close by 100 bars.

yes.... which removes them from the chart....

Plot it and try it - seeing is believing ...

well of course that occured to me.... but i can't see it.... the Ref(Ref(Close,100),-100) which is overlayed on the price bars plots only the close, no shift no removal.....

but anyway, forex is calling and losses are mounting.... who said it was easy money......h

Jose  
#11 Posted : Wednesday, February 7, 2007 6:08:11 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)
Ref(Ref(Close,100),-100) Hayseed, the plot bars are removed from the beginning of the chart - note the first hundred bars of the plot are missing. Try this indicator for easier viewing/understanding: pds:=Input("bars to plot [0 = all]",0,26000,25); x:=LastValue(If(pds=0,0,LastValue(Cum(1))-pds)); Ref(Ref(C,x),-x) jose '-)
hayseed  
#12 Posted : Wednesday, February 7, 2007 6:40:40 PM(UTC)
hayseed

Rank: Advanced Member

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

hey jose.... that i did notice but for the life of me could not see any point in deleting anything on that end of the chart..... i can see a point in adjusting on the most current end of the chart so my focus as there.....

kinda figured i was missing the point somehow...... thanks ......h

ifiaas  
#13 Posted : Thursday, February 8, 2007 2:38:54 AM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

hayseed wrote:

hey jose.... that i did notice but for the life of me could not see any point in deleting anything on that end of the chart..... i can see a point in adjusting on the most current end of the chart so my focus as there.....

kinda figured i was missing the point somehow...... thanks ......h

Thank you, Hayseed and Jose. Yes, removing the first x bars is exactely what I wanted. 100 here is just an example. And sure, the curve which is truncated is not Close. I took Close here just for an easy example, otherwise I have to paste lines of codes which are hard to explain -- you know, my English problem.

Jose, maybe you are right, there could be other source of confusion. Let me try with Close and 100 first. I will try to see whether it shifts by days. If it does not, I should try to figure out other errors...

Again, many thanks ~

ifiaas  
#14 Posted : Thursday, February 8, 2007 9:37:11 AM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

Think I've found the problem...

Since Metastock allow 500 history length. When the there are more than 500 bars in the chart, on each day, the oldest bar has to be moved out to allow the new bar to come in. Since my curve is anchored by (starting from) a index number of the bar (# of bars from the left border of current view window) instead of the exact date, as the oldest bar shifts out, the curve is now anchored to the date after the previously anchored day.

I think the solution is that, I have to change the anchor to specific date instead of a index number of the bar, so that my curve would shift together with the bars.

Thanks.

uasish  
#15 Posted : Friday, February 9, 2007 3:58:42 AM(UTC)
uasish

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 8/13/2005(UTC)
Posts: 170

Thanks: 7 times

ifiaas,

Why cant you increase the Load Option of the Chart ?

Asish

ifiaas  
#16 Posted : Friday, February 9, 2007 9:18:53 AM(UTC)
ifiaas

Rank: Member

Groups: Registered, Registered Users
Joined: 2/3/2007(UTC)
Posts: 13

Asish,

You are right, thank you!

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.