Announcement

Collapse
No announcement yet.

Code Help, BuiltEnvelope adjust ??

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

  • Code Help, BuiltEnvelope adjust ??

    This is the code for EFS built in moving average Envelope..
    /################################
    var study = new EnvelopeStudy(20, 0, "Close", false, 0.25);

    function preMain() {
    setPriceStudy(true);

    setDefaultBarFgColor(Color.blue, 0); // upper
    setDefaultBarFgColor(Color.red, 1); // basis
    setDefaultBarFgColor(Color.blue, 2); // lower
    }

    function main() {
    var vUpper = study.getValue(EnvelopeStudy.UPPER);
    var vBasis = study.getValue(EnvelopeStudy.BASIS);
    var vLower = study.getValue(EnvelopeStudy.LOWER);

    return new Array(vUpper, vBasis, vLower);
    /################################

    The above has a 20 period mov ave, with upper and lower bands based on 2.5% of the basis mov ave.

    My Request : I would like to have another upper and another lower band based on 2.5% *2 = %5.0 from basis mov ave.


    Thus 5 lines, or 4 bands on the basis

    Upper1 =+5.0%
    Upper=+2.5%
    Basis = 20 mov ave
    Lower=-2.5%
    Lower1=-5.0%

    I am very new to this EFS code, could some one please provide the code for me ? I seams easy but, I dont have the skills.

    Thx in advance

  • #2
    Hello Digs,

    Try this:

    PHP Code:
    var study = new EnvelopeStudy(200"Close"false2.5);
    var 
    study2 = new EnvelopeStudy(200"Close"false5.0);

    function 
    preMain() {
        
    setPriceStudy(true);

        
    setDefaultBarFgColor(Color.blue0); // upper2
        
    setDefaultBarFgColor(Color.blue1); // upper
        
    setDefaultBarFgColor(Color.red2); // basis
        
    setDefaultBarFgColor(Color.blue3); // lower
        
    setDefaultBarFgColor(Color.blue4); // lower2
        
    setCursorLabelName("Upper 2"0);
        
    setCursorLabelName("Upper  "1);
        
    setCursorLabelName("Basis"2);
        
    setCursorLabelName("Lower "3);
        
    setCursorLabelName("Lower 2"4);
    }

    function 
    main() {
        var 
    vUpper2 study2.getValue(EnvelopeStudy.UPPER);
        var 
    vUpper study.getValue(EnvelopeStudy.UPPER);
        var 
    vBasis study.getValue(EnvelopeStudy.BASIS);
        var 
    vLower study.getValue(EnvelopeStudy.LOWER);
        var 
    vLower2 study2.getValue(EnvelopeStudy.LOWER);

        return new Array(
    vUpper2vUppervBasisvLowervLower2);

    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

    Working...
    X