Announcement

Collapse
No announcement yet.

Custom / Spread Overlays

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

  • Custom / Spread Overlays

    Hi,

    I've tried to use the Symbol Overlay efs with a combined custom symbol (C + AXP + JPM), and the results are not being produced on a similar scaling to the symbol its being overlaid on - as it normally does.

    Any ideas?

    Thanks,
    Paul
    Attached Files

  • #2
    Hello Paul,

    The problem has to do with the order of math operations within the variable vSym. The call to close(0, 1, vSym) where vSym is equal to a string that looks like "0.8038C + AXP + JPM" is only applying the adjustment multiplier to C and not AXP or JPM. Your solution is to change vSym to just be "C + AXP + JPM" and then adjust the result of close(0, 1, vSym) after it returns the value of the spread (see lines 63 and 70).

    do30-fin-overlay2.efs

    PHP Code:
    var vLoaded false;

    function 
    preMain() {
        if (
    vLoaded == false) {
            
    setPriceStudy(true);
            
    setDefaultBarThickness(2);
            
    setDefaultBarFgColor(Color.RGB(254,197,24));

        } else {
            
    setCursorLabelName(vSymbol);
            
    setStudyTitle("FIN");
        }
    }

    var 
    vSymbol "";
    var 
    vSym "";
    var 
    vInterval 0;
    var 
    str = new String();
        
    function 
    main(nSymbolnFactor){
        if (
    vLoaded == false) {
        
            if (
    nSymbol == null
                
    nSymbol "C + AXP + JPM";
            
            
    vInterval getInterval();    
            if (
    nFactor == null) {
                var 
    close();
                if (
    == null) {
                    return;
                }
                var 
    c1 close(01nSymbol);
                if (
    c1 == null) {
                    return;
                }
                
    nFactor = (c/c1);
                
    nFactor *= 10000
                nFactor 
    Math.round(nFactor);
                
    nFactor /= 10000
                str 
    nFactor;
            } else {
                var 
    vFactor nFactor+'';
                var 
    strLength vFactor.length
                
    var de false;
                for (
    0strLength; ++i) {
                    
    str += vFactor.charAt(i)
                    if (
    vFactor.charAt(i) == ".") {
                        
    de true;
                    }
                }
                if (
    de == false) {
                    
    str += ".0"
                
    }
            }
            
    //vSym = (str + nSymbol + "," + vInterval);     // line 63
            
    vSym = (nSymbol "," vInterval);
            
    vLoaded true;
            
    vSymbol = (str " x FIN");
            
    preMain();
        }
        
        var 
    close(01vSym) * eval(str);              // line 70
        
    if (== null) {
            return;
        }

        return 
    v;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Hi Jason,
      Thanks for your help on this study, and also the Price Tick Change Study - much appreciated.

      Paul

      Comment

      Working...
      X