Announcement

Collapse
No announcement yet.

AutoEllipse

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AutoEllipse

    File Name: AutoEllipse.efs

    Description:
    Displays an Advanced Get Ellipse automatically.

    ** Please note this study requires a subscription to the Advanced Get Studies.


    Formula Parameters:
    n/a

    Download File:
    autoellipse.efs



    EFS Code:

    PHP Code:
    /************************
    Copyright © eSignal, 2003
    *************************

    Description: Displays an Advanced Get Ellipse automatically.

    ** Please note this study requires a subscription to the Advanced Get Studies.

    */

    function preMain() {
        
    checkVersion(2"http://share.esignal.com/ContentRoot/PowerStation/MAG-EFS/AutoEllipse.efs");

        
    addEntitlement("AGST""Not entitled for Advanced GET Studies");
        
    setStudyTitle("Auto Ellipse");
        
    setPriceStudy(true);
    }

    var 
    elliott = new GetElliottStudy(3000505350);

    var 
    nLastMRW        null// Last Most Recent Wave (used for reloading)
    var nLastMRWIndex   null;
    var 
    arWaves            = new Array();
    var 
    arWaveBar        = new Array();
    var 
    bEllipsesDrawn    false;
    var 
    dLastMRWHigh    null;
    var 
    dLastMRWLow        null;


    function 
    initWaves() {
        
    clearLineTool(LineTool.ELLIPSE);
        
        
    arWaves.length        0;
        
    arWaveBar.length    0;
        
    bEllipsesDrawn        false;
    }

    function 
    dumpWaves() {
        
    debugPrintln("Dumping Waves");
        var 
    i;
        for(
    0arWaveBar.lengthi++) {
            
    debugPrintln("    Wave[" "]" arWaves[i] + " Index: " arWaveBar[i]);
        }
    }

    var 
    WAVE_A            7
    var WAVE_B            8
    var WAVE_C            9

    var WAVENOTFOUND    1// this is a bar index

    function isABC(nWave) {
        
    nWave Math.abs(nWave);
        if(
    nWave == || nWave == || nWave == 9)
            return 
    true;
        return 
    false;
    }



    function 
    findPriorWave(nWave) {
        var 
    i;

        if(
    arWaves.length == 0)
            return 
    WAVENOTFOUND;

        var 
    nStart arWaves.length-1;
        
    nStart--;
        for(
    nStart>= 0i--) {
            var 
    nWaveBar Math.abs(arWaves[i]);

            
    // If a 4 stop searching
            
    if(nWaveBar == || nWaveBar == WAVE_A || nWaveBar == WAVE_B)
                return 
    WAVENOTFOUND;

            if(
    nWaveBar == nWave)
                return 
    arWaveBar[i];
        }    

        return 
    WAVENOTFOUND;
    }

    function 
    findPriorWaveABC(nWave) {
        var 
    i;

        if(
    arWaves.length == 0)
            return 
    WAVENOTFOUND;

        var 
    nStart arWaves.length-1;
        for(
    nStart>= 0i--) {
            var 
    nWaveBar Math.abs(arWaves[i]);

            
    // If a 4 stop searching
            
    if(nWaveBar <= 5)
                return 
    WAVENOTFOUND;

            if(
    nWave == WAVE_C && nWaveBar WAVE_C)
                return 
    WAVENOTFOUND;

            if(
    nWave == WAVE_B && nWaveBar WAVE_B)
                return 
    WAVENOTFOUND;

            if(
    nWaveBar == nWave)
                return 
    arWaveBar[i];
        }    

        return 
    WAVENOTFOUND;
    }


    function 
    findCurrentWave(nWave) {
        if(
    arWaves.length == 0)
            return 
    WAVENOTFOUND;

        var 
    nStart arWaves.length-1;
        var 
    nWaveBar Math.abs(arWaves[nStart]);

        if(
    nWaveBar == nWave)
            return 
    arWaveBar[nStart];

        return 
    WAVENOTFOUND;
    }


    function 
    findOnePriorWave(nWave) {
        if(
    arWaves.length 2)
            return 
    WAVENOTFOUND;

        var 
    nStart arWaves.length-1;
        var 
    nWaveBar Math.abs(arWaves[nStart-1]);

        if(
    nWaveBar == nWave)
            return 
    arWaveBar[nStart-1];

        return 
    WAVENOTFOUND;
    }


    function 
    FormatSI() {
        return 
    getSymbol() + "," getInterval();
    }



    function 
    main() {
        
    // What's the most recent wave?  If it has changed since last remembered, reload the EFS.
        
    var nMRW elliott.getValue(GetElliottStudy.MOSTRECENTWAVE);
        var 
    nMRWIndex elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX);
        
        if(
    nMRWIndex == null)
            return;

        if(
    getCurrentBarIndex() == 0) {
            if(
    nLastMRW == null) {
                
    nLastMRW nMRW;
                
    nLastMRWIndex nMRWIndex;
                
    dLastMRWHigh high(nMRWIndex);
                
    dLastMRWLow low(nMRWIndex);

            } else if(
    nLastMRW != nMRW || nMRWIndex nLastMRWIndex || low(nMRWIndex) != dLastMRWLow || high(nMRWIndex) != dLastMRWHigh) {
                
    nLastMRW null;
                
    nLastMRWIndex null;
                
    dLastMRWHigh null;    
                
    dLastMRWLow null;

                
    // Alert.playSound("krtechop.wav");
                // Alert.playSound("Pairing.wav");
                // Alert.addToList(FormatSI(), "Elliott Wave Change");
                
    reloadEFS();
                return;
            } else {
                
    nLastMRWIndex nMRWIndex;
                
    dLastMRWHigh high(nMRWIndex);
                
    dLastMRWLow low(nMRWIndex);
            }
        }    



        var 
    nBarState getBarState();
        
    // If ALLBARS, init the wave arrays and vars.
        // If newbar, shift the bar indexes
        
    if(nBarState == BARSTATE_ALLBARS) {
            
    initWaves();
        } else if(
    nBarState == BARSTATE_NEWBAR) {
            
    // Get the current wave for a specific bar and add the wave and bar to the arrays
            
    var nWave elliott.getValue(GetElliottStudy.WAVE);
            if(
    nWave != null) {
                
    arWaves.push(nWave);
                
    arWaveBar.push(getCurrentBarIndex());
            }

        }


        
    // If on the most recent bar and the ellipses haven't been drawn, search for them
        // and draw them.
        // Should the MRW change, a reload will occur and this will re-execute.
        
    if(bEllipsesDrawn == false && getCurrentBarIndex() == 0) {
            
    bEllipsesDrawn true;

            
    // debugPrintln("---- CurWave: " + nMRW);
            // dumpWaves();

            
    if(Math.abs(nMRW) == 4) {
                
    // If in a W4, do W2/W3, and W5/W3.
                
    var nBar4 findCurrentWave(4);
                var 
    nBar2 findPriorWave(2);
                var 
    nBar3 findPriorWave(3);

                var 
    nBar5 findPriorWave(5);
                var 
    nBarC findPriorWave(WAVE_C);

                
    // debugPrintln("Bar2: " + nBar2);
                // debugPrintln("Bar3: " + nBar3);
                // debugPrintln("Bar5: " + nBar5);
                // debugPrintln("BarC: " + nBarC);

                
    if(nBar5 != WAVENOTFOUND && nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar5nBar3"5/3");
                } else if(
    nBarC != WAVENOTFOUND && nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBarCnBar3"C/3");
                }

                if(
    nBar2 != WAVENOTFOUND && nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar2nBar3"2/3");
                }
                
                if(
    nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar3nBar4"3/4");
                }


            } else if(
    Math.abs(nMRW) == 3) {
                
    // If in a W4, do W2/W3, and W5/W3.
                
    var nBar3 findCurrentWave(3);
                var 
    nBar2 findPriorWave(2);

                var 
    nBar5 findPriorWave(5);
                var 
    nBarC findPriorWave(WAVE_C);

                
    // debugPrintln("Bar2: " + nBar2);
                // debugPrintln("Bar3: " + nBar3);
                // debugPrintln("Bar5: " + nBar5);
                // debugPrintln("BarC: " + nBarC);

                
    if(nBar5 != WAVENOTFOUND && nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar5nBar3"5/3");
                } else if(
    nBarC != WAVENOTFOUND && nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBarCnBar3"C/3");
                }

                if(
    nBar2 != WAVENOTFOUND && nBar3 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar2nBar3"2/3");
                }


            } else if(
    Math.abs(nMRW) == WAVE_C) {
                
    // If in a C, A/B, B/C
                
    var nBarA findPriorWaveABC(WAVE_A);
                var 
    nBarB findPriorWaveABC(WAVE_B);
                var 
    nBarC findCurrentWave(WAVE_C);
                var 
    nBar4 findOnePriorWave(4);

                
    // debugPrintln("BarA: " + nBarA);
                // debugPrintln("BarB: " + nBarB);
                // debugPrintln("BarC: " + nBarC);
                // debugPrintln("Bar4: " + nBar4);

                
    if(nBar4 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar4nBarC"4/C");
                    
    // 4->C (aka 4->5)
                
    } else if(nBarA != WAVENOTFOUND && nBarB != WAVENOTFOUND) {
                    
    // If BarB is WAVENOTFOUND then B & C are on the same bar.
                    
    addLineTool(LineTool.ELLIPSEnBarAnBarB"A/B");
                    
    addLineTool(LineTool.ELLIPSEnBarBnBarC"B/C");
                }

            } else if(
    Math.abs(nMRW) == 5) {
                
    // projecting the W3?

                // If in a W5, W4/W5
                
    var nBar4 findOnePriorWave(4);
                var 
    nBar5 findCurrentWave(5);

                if(
    nBar4 != WAVENOTFOUND) {
                    
    addLineTool(LineTool.ELLIPSEnBar4nBar5"4/5");
                }

                
    // debugPrintln("Bar4: " + nBar4);
                // debugPrintln("Bar5: " + nBar5);


            
    }




        }


        return;
        

    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11
Working...
X