|
|
Weekly Chart (Bars)
Last post 11-03-2009, 23:05 by muheeb. 17 replies.
-
-
-
-
-
-
10-29-2009, 12:23 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
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
|
|
-
10-29-2009, 15:33 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
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;
|
|
-
11-01-2009, 1:35 |
-
muheeb
-
-
-
Joined on 10-26-2009
-
-
Posts 10
-
-
|
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?
|
|
-
11-01-2009, 2:01 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
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
|
|
-
11-01-2009, 2:27 |
-
muheeb
-
-
-
Joined on 10-26-2009
-
-
Posts 10
-
-
|
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.
|
|
-
11-01-2009, 13:59 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
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
|
|
-
11-02-2009, 1:34 |
-
muheeb
-
-
-
Joined on 10-26-2009
-
-
Posts 10
-
-
|
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.
|
|
-
-
-
11-02-2009, 14:25 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
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
|
|
-
11-02-2009, 22:51 |
-
muheeb
-
-
-
Joined on 10-26-2009
-
-
Posts 10
-
-
|
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.....
|
|
-
11-03-2009, 14:11 |
-
mstt
-
-

-
Joined on 07-26-2005
-
-
Posts 408
-
-
|
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
|
|
-
11-03-2009, 23:05 |
|
|