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

Notification

Icon
Error

Options
Go to last post Go to first unread
muheeb  
#1 Posted : Sunday, October 25, 2009 1:22:14 PM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

is there a way to plot a weekly chart that starts from: 1. First Trading Day: Saturday Last Trading Day: Wednesday and the other one in case if I want to plot a weekly chart that starts: 1. First Trading Day: Monday Last Trading Day: Friday please explain how the above can be accomplished.
mstt  
#2 Posted : Tuesday, October 27, 2009 3:07:04 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 Muheeb

I don't know of any easy way to do what you're asking but it should be easy to change my EOD Multi-Frame formulas to plot weekly values with a periodicity offset of 1 to 6 daily bars. This would allow you to plot a range of weekly indicators conforming to any non-standard weekly makeup. The concept has already been proven with a split-frame now available for the intraday series of Mult-Frame formulas. If you care to check out one of the EOD formulas at http://www.metastocktips.co.nz/more_formulas.html and get back to me I will follow it up for you.

Roy

muheeb  
#3 Posted : Thursday, October 29, 2009 1:22:38 AM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

okay I did look at the formulas..and this is something that I can copy and paste. so, can you create one that will customize the weekly view? is this going to be for a fee? please provide details. thank you
mstt  
#4 Posted : Thursday, October 29, 2009 3:40:16 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 Muheeb

There'll be no fee but I will need to know which formula or formulas you'd like customized. OHLC, EMA, or what?

Roy

muheeb  
#5 Posted : Thursday, October 29, 2009 6:42:53 AM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

Thank you Roy for the quick response... please consider doing the formula with OHLC and we'll give it a test and take it from there... I appreciate it.. you know what the weird thing is....I installed metastock on another laptop and it shows me the weekly chart with last trading day as sunday..on another machine it shows the weekly chart with last trading day as friday.... I cant understand how it works...
mstt  
#6 Posted : Thursday, October 29, 2009 12:23:49 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 Muheeb

The DayofWeek() function numbers Monday through Sunday as days 1 to 7 and as far as I'm aware days 6 and 7 are always regarded as the weekend. If you select Tools/Options from the menu bar and open Chart Options you'll find a Data section which allows you to ignore weekend data (days 6 and 7). Under the Display section of the same window there are also options to Show empty weekends and Show empty holidays. These options being set differently might explain variations between two Metastock installations (or not). I'm aware of these options but have never experimented with them. What I have generally found to be true with MetaStock is that there is always an explanation for weird things happening, and mostly it's the user.

Hopefully I can post a modified OHLC formula here later in the day.

Roy

mstt  
#7 Posted : Thursday, October 29, 2009 3:33:12 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 Muheeb

Here's the "Multi-Frame D OHLC" indicator set up for weekly data with the first day of the week being Monday and the last day of the week being Sunday. Adjust the offset to change the beginning/end of each week. Each offset increment will delay the transition from one week to the next by one bar. When used without Saturday or Sunday daily data the 5 and 6 offset settings will make no difference to the end-of-week plots. The offset feature does not affect monthly or higher periodicity results in any way.

Roy

{Multi-Frame D OHLC}
{Requires Equis Forum DLL}
{Roy Larsen, 2008-2009, 30/10/09}

{User settings}
N:=Input("Multi-Frame D OHLC (end-of-week offset by N days)",0,6,0);
J:=Input("Months per Frame, 0=Weekly",0,12,0);
J:=If(J<5 OR Mod(J,3)=0 AND (J<>9),Int(J),-1);
Q:=Input("Mode, 0=Static 1=Dynamic 2=Delayed",0,2,1);
{Update on last bar, new bar or new frame}

{Timing signals}
{Day counter by metastocktools.com}
D:=DayOfWeek();M:=Month();Y:=Year();
Z:=Cum(1);F:=Rnd(Life(291231));
M:=If(J=0,ValueWhen(1,Z=1,F+D-N-1)-F,
(Y-ValueWhen(1,Z=1,Y))*12+M);
I:=If(J=0,Int(M/7),Int((M-1)/Max(1,J)));
I:=I>ValueWhen(2,1,I);
G:=LastValue(J<0 OR Lowest(Sum(I>0,5))=5);
I:=ExtFml("Forum.Sum",I,1);M:=G+I;
F:=ExtFml("Forum.Sum",Ref(I,1),1)*(M=0)*(Z>1)+G;
B:=LastValue(Z);A:=B-1=Z;B:=B=Z;
F:=F+B*(Q=0)*(J=0)*(D=5);
J:=If(F,1,(Alert(F,2)=0)*M*2*(Z>1));
J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J);
J:=If(G,1,If(Q=2,M*2,J));

{Frame prices}
Om:=ValueWhen(1,M+(Z=1),O);
Hm:=HighestSince(1,M+(Z=1),H);
Lm:=LowestSince(1,M+(Z=1),L);
Om:=ValueWhen(1,J,If(J=1,Om,ValueWhen(2-G,1,Om)));
Hm:=ValueWhen(1,J,If(J=1,Hm,ValueWhen(2-G,1,Hm)));
Lm:=ValueWhen(1,J,If(J=1,Lm,ValueWhen(2-G,1,Lm)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Om; Hm; Lm; K;

muheeb  
#8 Posted : Sunday, November 1, 2009 1:35:07 AM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

Thank you Roy,

I copied the formula and the forum dll. However, when I open a weekly chart and then I tried to apply the formula nothing changes. I tried to offset it by 1,2,3,4,5 and no matter what..nothing happens.

when I tried to apply it again it says that the indicator already plotted in the window, plot it anyway and still nothing happens.

am I missing something?

mstt  
#9 Posted : Sunday, November 1, 2009 2:01:01 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 Muheeb

How could you have plotted the original weekly OHLC if you didn't have the Forum DLL installed? You don't say if the modified indicator plots 4 visible plots, N/A, or something else. For what it's worth I just copied the indicator from two pages above as <New Indicator> and got exactly the weekly OHLC prices I expected. Options 0, 5 and 6 plot weekly prices as of each Friday on my data, and options 1-4 plot weekly data based on Monday to Thursday end-of-week orientation. As intended. Open up the Data window so that you can at least see whether the indicator is plotting anything or just returning N/A.

I assume you restarted MetaStock after installing the Forum DLL?

With a little more information I may be able to figure out what, if anything, you're doing wrong. What do you mean by "nothing happens"? Does that mean you see nothing at all or that you see no plot changes when changing the options? What days of the week does your data have? More information please!!!

Roy

muheeb  
#10 Posted : Sunday, November 1, 2009 2:27:19 AM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

what I did is..I copied forum DLL and pasted in External Functions DLLs folder located in (does this fullfill the installation part of the forum DLL?)

c:\Program Files\Equis\Metastock\External Functions DLLs

after I did this Metastock accepted the formula as it was telling me that DLL file was missing before I copied the forum dll.

after that, I restarted Metastock...opened it and selected a symbol from my list. by default, metastock opens the chart with D periodicity. then I drag and drop the indicator that I created to have the formula above and applied it to the data window frame, so, it opened a new empty inner window and there was nothing there. there was no error message or NA or anything...it is just empty.

mstt  
#11 Posted : Sunday, November 1, 2009 1:59:21 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 Muheeb

Yes, it does seem that you have followed the correct procedure for installing the DLL and indicator. Although MetaStock error messages can seem rather cryptic at times they generally point to a quite specific cause and solution.

Opening a new window to display an indicator is not wrong. In this case, however, the indicator plots weekly prices and it could be plotted in the same window as the chart without casing any major issues, apart from the one we’re already trying to deal with of course.

When an indicator is dropped into a window and no plot is visible it can mean a number of different things. The two most likely possibilities are that the plot is unscaled and zero, or N/A (the indicator is incapable of generating a real and visible output). An unscaled plot of a constant (most often zero) sits along the bottom edge of a window such that it can be detected and selected by drawing the cursor over it, but without it being visible to the user. Once selected a left or right scale can be applied and the plot will then become visible, of course depending on what other plots use the same scale.

An N/A plot (no output possible) is easy to check for and this is done by opening the Data Window (click the crosshairs on the toolbar) and checking what value corresponds to the problem indicator. This window can also tell you if there’s more than one copy of any indicator currently plotted – it’s a useful diagnostic tool. If the indicator is “plotting” N/A it can be helpful to draw the cursor across the chart and see if a real value appears at or near the right side. If plotted for only one or two bars an indicator in a window with other items can be very hard to locate.

You should now have a better idea of the problem. What I’d like to know, in addition to the outcome of these initial checks, is this. How many price bars are displayed on your chart? What ticker symbol have you applied the indicator to? What days of the week does the ticker data have?

An simple but effective method of tracking down the cause of an N/A plot is to add the variable name (terminated by a semicolon) after each variable definition in turn (only check one definition at a time). The first variable that does not plot when the Indicator Builder is closed will most likely be the source of the problem. Obviously as this series of tests moves from one variable to the next the inserted variable names already tested must be removed. If you get as far as performing this check then it would be really helpful to know the results. Thanks.

Roy

muheeb  
#12 Posted : Monday, November 2, 2009 1:34:27 AM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

let me start by answering the questions, the rest I need to read couple of times to do the intial checks, that if I understand clearly.

How many price bars are displayed on your chart?

I am loading a data for 1 year so I see a lot of price bars from the first date to the last one. I am sure I understand your question but I assumed this is what you are looking for.

What ticker symbol have you applied the indicator to?

I applied this to a ticker symbol in Saudi Arabia Stock Market, so the ticker is 1010 for instance.

What days of the week does the ticker data have?

Saturday through Wednesday.

First tradiong day of the week: Saturday

Last trading day of the week: Wednesday

Thursday and Friday are weekend days.

I tested the indicator with aother stock symbol from the US and it worked. the price style is not bars(high, low, close) but it plot a chart with 3 lines.

my comments about the interface is this: it would be really nice if the interface had only one parameter for instance:

- First day of the week: (it should accept (1,2,3,4,5,6,7))

- Week duration: 5 or 6

it should also plot the volume for that week.

mstt  
#13 Posted : Monday, November 2, 2009 1:59:19 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 Muheeb

Thankyou for your responses to my questions. From what you've said I think the indicator problem must lie with the combination of data and indicator. I'll look at the situation tomorrow, I'm sure there's a way through this. Once sorted out you'll need the weekly volume indicator as well. It's not practical to have volume and price plot from the same indicator as the scale of one would severely distort the other. The weekly volume could be added as a histogram in its own window into the default template.

Roy

muheeb  
#14 Posted : Monday, November 2, 2009 12:16:32 PM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

how about the two paramters interface for the indicator? you think it is doable! is it a good idea? let me know your thoughts 1. enter the start of the trading day for the week: 2. duration of the trading week: (5 or 6) thank you in advance for all the great efforts.
mstt  
#15 Posted : Monday, November 2, 2009 2:25:44 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 Muheeb

I can’t find ticker 1010 for Saudi Arabia. In fact I can’t find any historical data for Saudi Arabia. However I did manage to convert some data to conform to a Saturday through Wednesday weekly format (by advancing all dates by two days). Unfortunately this did not result in the loss of any plots so I’m not really any further ahead. Can you email the data for a couple of securities to me at rlarsen@quik.co.nz. CSV or XLS format should be good but MetaStock format is good too, as long as MASTER and EMASTER files are included with the DAT files. It’s possible that a setting on your computer or MetaStock might be the cause but I’d like to conclusively rule out the data as the cause first.

MetaStock is not capable of plotting a second price chart in the same active window as the primary chart so plotting weekly price bars along with daily price bars is not an option. However, by using a few sneaky tricks and a variety of styles it would be possible to simulate a weekly price bar sitting over the top of the Wednesday daily bar. The simulated weekly bar could also be plotted in a separate window. Of course we need to resolve the N/A display problem before attempting to create a realigned weekly price bar.

Simulated weekly bars and other displays making use of MetaStock styles and color options really need to be created and inserted into a template for easy access – it’s not practical to recreate special displays for individual charts because of the time and care required.

There are over 60 formulas in each of the Multi-Frame families of indicators. The reason for the range of user options is to give users with very different needs the ability to set those options for their own needs and not be stuck with what’s best for someone else. There’s nothing to say that you can’t customize a particular formula to suit yourself. Therefore I’d prefer to leave the offset at 0-6 rather than 1-7. Offsetting by 7 days is really not an offset at all but the same as no offset (0 days). Similarly, I see no point in setting a week’s duration to 5 or 6 bars – it doesn’t matter how the days of the week are aligned because there is always going to be seven days in a week. The fact that some days will have no data does not mean that the indicator needs to be changed to accommodate the fewer number of days. The timing module is supposed to handle any gaps seamlessly, and has done that successfully in all tests up until now. Once the present problem is resolved I could look at your preferences as a separate issue.

It would be very helpful if you can test the outputs of all variables in the code timing section and report back at which point the display failure occurs.

Test from Z in the sequence of Z, F, M, I, I, G, I, M, F, B, A, B, F, J, J, and J. You’ll need to place braces around the existing outputs like this {Om; Hm; Lm; K;} so that there’s no confusion about what is generating the test output. I don’t need to know what a test output looks like, just whether it’s present or produces an N/A. to create an output from the Z variable you would change the following line from

Z:=Cum(1);F:=Rnd(Life(291231)); to

Z:=Cum(1); Z; F:=Rnd(Life(291231));

Then remove the “Z;” and change the original line to

Z:=Cum(1);F:=Rnd(Life(291231)); F; and so on....

Any failure to plot found by this test will cascade through to most or all following variables so don’t bother to go any further if you find one variable that fails. (You haven't confirmed yet that the Data Window shows N/A for the indicator on Saudi data)!!! Note that a straight-line plot that is not visible is not a failure – only an N/A result in the data window right across the chart represents an output failure. Thanks for your help on this.

Roy

muheeb  
#16 Posted : Monday, November 2, 2009 10:51:57 PM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

okay, I did send you an email. Now, the NA issue, okay I just tried it for the last time and guess what...I did see a chart this time....I have no idea why it was not doing this the first time even though I tried many times.

I sent you the data and URL where saudi data can be downloaded. check it out and lets see where we could go from here. Please note that the chart is not in Bars style which makes it hard to read.....

mstt  
#17 Posted : Tuesday, November 3, 2009 2:11:36 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 Muheeb

I have cycled through enough charts now and it seems that some of the securities you sent me do not have OPEN data. This will certainly cause the OHLC weekly indicator to fail. It was because of this potential problem with some types of securities that I created HLC versions of the OHLC indicators a little while back. I’ve not found any other problems or reasons why “Multi-Frame D OHLC” should fail to plot. I’m still working on a template for simulating weekly bars based using the OHLC or HLC indicators as a base.

Roy

muheeb  
#18 Posted : Tuesday, November 3, 2009 11:05:16 PM(UTC)
muheeb

Rank: Member

Groups: Registered, Registered Users
Joined: 10/25/2009(UTC)
Posts: 11

great...waiting to give it a try
rkkarnani  
#19 Posted : Thursday, March 25, 2010 10:54:24 PM(UTC)
rkkarnani

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 11/23/2009(UTC)
Posts: 13

mstt, it simply awesome to find that people like you are still around who give so much time for things where there is no return for you!!! Hats off!!!
uasish  
#20 Posted : Thursday, April 1, 2010 8:51:59 PM(UTC)
uasish

Rank: Advanced Member

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

Thanks: 7 times

Mr Karnani,

You are viewing one of THE best coder of Metastock in this planet.Jose/Wabbit everybody of us just keep quite and LEARN from Roy.I am doing this since 8 Yrs now.

The problem of our Indian Derivative's Closing of Thursday was resolved earlier by Wabbit few years back on 1 of my query ,can not find that thread now.

Asish

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.