Announcement

Collapse
No announcement yet.

Normalizing the output?

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

  • Normalizing the output?

    (referring to the Relative Strength Ratio under Spread / Overlay)
    How can one plot this on a scale between 0 and 100?

    In the last "if" statement: if (vSym != null) {........

    I would like to do somthing like this:

    var theSpread = close()/b;

    //now find the lowest low in theSpread over the last 10 periods
    var lLow = llv(10, theSpread);

    //now find the highest high in theSpread over the last 10 periods
    var hHigh = hhv(10, theSpread);

    normSpread = ((theSpread - lLow) / (hHigh - lLow)) *100;

    return normSpread;

    Thanks for your assistance.
    Last edited by joemeyer; 03-08-2006, 03:30 PM.

  • #2
    joemeyer
    The easiest way to do that is to write a new efs in which you use the efsExternal() function to call the RelativeStrengthRatio.efs and create the series which you then use as the source for the builtin Stochastic %K study [since that is what your equation for normSpread actually is].
    In this case all you need to do is add the following in the main function of the new efs
    PHP Code:
    var Ratio efsExternal("RelativeStrengthRatio.efs","$SPX");//this calls the external efs, passes the 
                                                               //symbol used for the ratio and creates the series
    var normSpread stochK(10,1,1,Ratio);//the Stochastic %K function uses Ratio as the source 
    The above could also be condensed as follows
    PHP Code:
    var normSpread stochK(10,1,1,efsExternal("RelativeStrengthRatio.efs","$SPX")); 
    In either case use normSpread in the return statement. Save the script in the same folder in which you have RelativeStrengthRatio.efs
    If you need a ready made template for the efs or would like to make the symbol you are passing through efsInternal() a user definable parameter see this thread.
    For information on the efsExternal() function and its syntax see this article in the EFS KnowledgeBase. You can also find an explanation together with several examples in this thread
    Alex

    Comment

    Working...
    X