Discussions
»
Special Interest Groups
»
Basic Coding Techniques
»
How can the script knows whether a weekly chart or daily chart is used?
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 10/1/2006(UTC) Posts: 17
Thanks: 3 times Was thanked: 1 time(s) in 1 post(s)
|
Dear Metastock Gurus,
I would like to adjust the number of periods for some certain forumlas depending on whether it is a weekly chart or daily chart. For example, if I want to calculate a 10-week moving average, then the number of periods will be 10 for weekly chart and 50 for daily chart.
The problem I am facing is that I do not know how to get the script to detect whether the chart is currently a weekly chart or daily chart.
Can someone advise?
Thank you very much in advance.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
Only way I can think of is to use the date functions and subtract dates and compare differences. You could also use the input function. I usually have copies of the same indicator with one variable different when I run into this situation.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
There are two ways to test for the chart periodicity. Using MSFL you
can run a relative slow and complicated series of formulas to make the
discovery. It works most of the time, but on lesser traded commodities
it (allegedly) occassionally throws back false positives and true negatives. (I don't use this method myself so cannot guarantee the accuracy of any results)
The other option is to write an external function as the information
you are seeking is already available to these external library
functions and extracted with absolute minimum error.
Hope this helps.
wabbit [:D]
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Special Interest Groups
»
Basic Coding Techniques
»
How can the script knows whether a weekly chart or daily chart is used?
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.