Announcement

Collapse
No announcement yet.

Valuation Index extracted from L.Williams works

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Valuation Index extracted from L.Williams works

    Hi from Italy!

    Can someone help me with the development of a formula extracted from some works of Larry Williams a measure of the flow of price between the primary market we are trading and a secondary market that influences the primary, such as GOLD.

    I have little experience of programming so your help would be appreciated

    Study Title : Williams Valuation Index

    Non-Price Study, Indicator without back testing

    Returns a value from 0 to 100

    Input: close values of the market we are examining and of the Gold future (symbol ZG #F is ok)

    Calculations:
    - Divide the close price of the market we are examining by the price of Gold and multiply by 100
    - Construct a 2-period exponential average of this spread and a 22-period exponential average of this spread
    - Subtract the 2-period average from the 22-period average
    - Let's call this reading PVI (Preliminary Valuation Index)
    - Let's then take the lowest PVI reading of the last 25 periods and call it lowestPVI, and the highest PVI reading of the last 25 periods and call it highestPVI
    - The value to return is given by the formula

    Code:
     (PVI - lowestPVI) / (highestPVI - lowestPVI)
    Thank you very much for your help
    Gianni
    da Milano

  • #2
    volpotten
    This can easily be done using efs2. Here is how to create a basic version of the study you want.
    First create a function called (for example) calcSpread. As the return statement for that function you use

    PHP Code:
    return (close()/close(sym("zg #f")))*100
    This will compute the ratio between the Close of the symbol being charted and the Close of the Gold symbol.
    Then create a second function called calcPVI. In that function you create the two moving averages using calcSpread as the source. To do this you use the efsInternal() function which creates the required data series. For example

    PHP Code:
    var Short ema(2,efsInternal("calcSpread")); 
    Repeat the same for the other average which you will call Long then as the return statement you use

    PHP Code:
    return Short-Long
    At this point in function main you call the calcPVI function using again efsInternal(). This will create the required series to use in the upperDonchian() and lowerDonchian() functions to determine the highest and lowest values of PVI. For example

    PHP Code:
    var PVI efsInternal("calcPVI");//this creates the series from the called function
    var highestPVI upperDonchian(25,PVI);//this computes the highest value of PVI in last 25 bars
    //repeat for lowestPVI using lowerDonchian 
    For the return statement of function main you can now use the same equation you have in your post
    For more information and examples on the efsInternal() function used in the example above see this thread
    Alex

    Comment


    • #3
      Alexis,
      thank you for your explanations.

      As I already mentioned in the Italian forum, not only do your replies solve a specific problem, but additionally they act as a tutorial to improve my and I believe others' programming capability.

      EFS programming becomes easy with your help and guidance
      Gianni
      da Milano

      Comment


      • #4
        Gianni
        You are most welcome and thank you for the compliment
        Alex

        Comment

        Working...
        X