Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2006(UTC) Posts: 33
|
I've been programming for a while but am used to a more verbose style of programming.
Whenever I tackle a new language, it seems easier to me if I can set breakpoints and see values. That being said, the next easiest is a function that returns a value. I haven't been able to find either in metastock.
For example, I don't understand the following (from Jose's Pivot calcs):
dStart:=DayOfMonth()<>Ref(DayOfMonth(),-1);
I understand the REF() and I would understand an if/else statement which I assume this is an abbreviation for. I'm not neccessarily looking for someone to give me this specific explanation, but rather how to approach something like this when I want to see what the value of dStart is.
If anyone can understand where I'm coming from and has been there, I would appreciate the "getting over the hump" help.
Jer
|
|
|
|
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)
|
Jer, you are on the right track to understanding MSFL.
Whenever I put any code together which either behaves unexpectedly or which I don't fully understand, I break it down into its basic components and plot each one separately - a manual/visual breakpoint of sorts.
For example,
Month()Ref(Month(),-1)
(month's start signal), I would plot both components in the same window below a chart:
Month();
Ref(DayOfMonth(),-1)
Plotting the above results in two plots, which overlap on every bar except at the beginning of each month. So, when plot1plot2, that is our start of month (binary) signal.
A chart is worth a thousand words (wish we could post one here!)
jose '-)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2006(UTC) Posts: 33
|
Thanks Jose. I appreciate all your code and help that you have given others. It's much appreciated.
If we agree to only use the before mentioned line as an example, let me ask a few more naive questions (keep in mind I'm not critizing - just wish to understand how to understand :-) )
My thought process goes like this. Ah , dStart represents a day, DayofMonth() represents a day and the Ref() is the day before. I see the comparison and think binary. But dStart is assumed to be a day. So what gives? (I think). I need to see what dstart is.
Since I'm dealing with a chart that has values of say 50-80 (just for the sake of discussion), how would it show a date? How would I know what I see when I plot it? Is it showing a 1 as in the first day of the month or a 1 as in a 1/0?
That's the stuff that's holding me up and I dont know how to "see" what the values are.
|
|
|
|
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)
|
Jer, in order to "see" how the code works, you need to literally see how it works. Plot the components in a separate window as outlined in my post, and understanding will then all come together.
Also, take a look at the formula primer, available from the files section I believe.
jose '-)
|
|
|
|
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.