Announcement

Collapse
No announcement yet.

Volume Scaling

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

  • Volume Scaling

    Anybody got a script or a procedure that rescales daily volume bars so that really tall bars don't set the scale factor so that all the rest of the bars can'b be read?

    My first thought was to use a log scale but the changing to log scale seems to only control the price field. I wrote a simple log volume scripts but that gives me the log of the volume which is non intutitive to interpret. I want to control the volume scale to be nonlinear.

    Mike Scott
    Tarzana, CA
    ....Mike

  • #2
    Re: Volume Scaling

    Hi Mike,

    I played around with this, and have come up with a technique. As you said, it is not a typical normalization. I thought of getting a median or range of the data on efs start-up then using a sigmoid function, but after re-reading your post I figured I would try a nonlinear suggestion. Maybe it will give you some ideas.

    Hope this helps.

    Steve

    Originally posted by mike_scott
    Anybody got a script or a procedure that rescales daily volume bars so that really tall bars don't set the scale factor so that all the rest of the bars can'b be read?

    My first thought was to use a log scale but the changing to log scale seems to only control the price field. I wrote a simple log volume scripts but that gives me the log of the volume which is non intutitive to interpret. I want to control the volume scale to be nonlinear.

    Mike Scott
    Tarzana, CA

    PHP Code:
    /* 
    normalizing volume.efs test script to reduce volume spikes by using some JavaScript 
    built in MATH functions.  Not written for efficiency, more of a science project
    or for consideration

    Written By Steve Hare 4/8/2011
    For a question in thread \"http://forum.esignalcentral.com/showthread.php?s=&threadid=35919\"
    Saved in FileShare \"http://share.esignal.com/groupgo.jsp?groupid=339\"
     */
     
    function preMain() {
     
    setPriceStudy(false);
     
    setStudyTitle("VolNormalized");
     
    setCursorLabelName("normalized Volume"0);
     
    setCursorLabelName("volString"1);
     
    setDefaultBarFgColor(Color.blue0);
     
    setDefaultBarFgColor(Color.red1);
     
    setPlotType(PLOTTYPE_LINE0);
     
    setDefaultBarThickness(10);
    }
    var 
    bInitV;

    function 
    main() {
     if (!
    bInit) {
      
    volume();
      
    bInit true;
     }
     var 
    vol V.getValue(0);
     var 
    volString vol ""//~ converting number to string so it is not plotted in chart but available in cursor window
     
    return [normalizeVolume(vol), volString];
    }

    function 
    normalizeVolume(x) {
     var 
    Math.sqrt((Math.log(1) + 1)) * (Math.pow((x), 4));
     return 
    n;
    }
    //~ end of function normalizeVolume(x)

    function normalizeSigmoid(x) { // ~ not used
     
    return / (Math.exp(-x)); //~ applying a Sigmoid Squashing technique 
    }
    //~ end of normalizeSigmoid


    //~ alternate techniques ~~~~~~~~~~~~ 
    /* function normalizeVolume(x) {
     //~ var n=Math.pow((1+x),1/2);
     //~ var n=(Math.log(x)+1)*(Math.pow((1+x),1/2);
     //~ var n=(Math.log(x)+1)*(Math.pow((1+x),1/2)-Math.pow((1+x),1/4));
     //~ if(x>68000){x*=200;}
     //~ var n=Math.sqrt((Math.log(x+1)+1))*(Math.pow((1+x),1/2)-Math.pow((1+x),1/3))/50;
     //~ alternate techniques ~~~~~~~~~~~~
     var n=2*Math.sqrt((Math.log(x+1)+1))*(Math.pow((2+x),1/4));
     return n;
    } */
    //~ end of function normalizeVolume(x) 
    I saved the efs in my fileShare too.
    Last edited by ; 04-08-2011, 06:21 PM.

    Comment

    Working...
    X