in Search

How can the script knows whether a weekly chart or daily chart is used?

Last post 04-03-2008, 19:31 by wabbit. 2 replies.
Sort Posts: Previous Next
  •  02-08-2008, 9:46 26499

    How can the script knows whether a weekly chart or daily chart is used?

    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.
  •  04-01-2008, 17:06 26833 in reply to 26499

    Re: How can the script knows whether a weekly chart or daily chart is used?

           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.   
  •  04-03-2008, 19:31 26842 in reply to 26499

    Re: How can the script knows whether a weekly chart or daily chart is used?

    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 Big Smile [:D]


    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

View as RSS news feed in XML