Announcement

Collapse
No announcement yet.

2010 Sep: Getting Clear With Short-Term Swings

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

  • 2010 Sep: Getting Clear With Short-Term Swings

    File Name: ClearSwingLine.efs

    Description:
    Getting Clear With Short-Term Swings

    Formula Parameters:
    Line or Color Bars : Line

    Notes:
    The related article is copyrighted material. If you are not a subscriber
    of Stocks & Commodities, please visit www.traders.com.


    Download File:
    ClearSwingLine.efs



    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
        eSignal (Copyright c eSignal), a division of Interactive Data 
        Corporation. 2010. All rights reserved. This sample eSignal 
        Formula Script (EFS) is for educational purposes only and may be 
        modified and saved under a new file name.  eSignal is not responsible
        for the functionality once modified.  eSignal reserves the right 
        to modify and overwrite this EFS file with each new release.

    Description:        
        Getting Clear With Short-Term Swings
    Version:            1.00  07/13/2010

    Formula Parameters:                     Default:
        Line or Color Bars                  Line

    Notes:
        The related article is copyrighted material. If you are not a subscriber
        of Stocks & Commodities, please visit [url]www.traders.com.[/url]

    **********************************/
    var bInit false;
    var 
    bVersion null;

    function 
    preMain() {
        
    setPriceStudy(true);
        
    setShowTitleParameters(false);
        
    setStudyTitle("Getting Clear With Short-Term Swings");
        
    setShowCursorLabel(true0);
        
    setCursorLabelName("SwLine"0);
        
    setDefaultBarFgColor(Color.cyan0);
        
    setPlotType(PLOTTYPE_INSTANTCOLORLINE0);
        
    setDefaultBarThickness(20);
     }

    var 
    upsw 0;
    var 
    xHigh null;
    var 
    xLow null;
    var 
    nHHigh 0;
    var 
    nHLow 0;
    var 
    nLHigh 0;
    var 
    nLLow 0;

    function 
    main() {
    var 
    nBarState getBarState();
    var 
    nHigh 0;
    var 
    nLow 0;
    var 
    nResult 0;
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;   
        if (!
    bInit) { 
            
    xHigh high();
            
    xLow low();
            
    nHHigh xHigh.getValue(0);
            
    nHLow xLow.getValue(0);
            
    nLHigh xHigh.getValue(0);
            
    nLLow xLow.getValue(0);
            
    bInit true
        }
            
    nHigh xHigh.getValue(-1);
            
    nLow xLow.getValue(-1);
            if (
    upsw == 1) {
                if (
    nHigh nHHighnHHigh nHigh;
                if (
    nLow nHLownHLow nLow;
                if (
    nHigh nHLow && nBarState == BARSTATE_NEWBAR) {
                    
    upsw 0;
                    
    nLLow nLow;
                    
    nLHigh nHigh;
                }
            } else {
                if (
    nLow nLLownLLow nLow;
                if (
    nHigh nLHighnLHigh nHigh;
                if (
    nLow nLHigh && nBarState == BARSTATE_NEWBAR) {
                    
    upsw 1;
                    
    nHHigh nHigh;
                    
    nHLow nLow;
                }
            }
        if(
    upsw == 1) {
            
    nResult nHLow;
            
    setBarFgColor(Color.cyan);
        }
        if(
    upsw == 0)  {
            
    nResult nLHigh;
            
    setBarFgColor(Color.magenta);
        }
        if (
    nResult == 0) return;
        return 
    nResult;
    }

    function 
    verify() {
        var 
    false;
        if (
    getBuildNumber() < 779) {
            
    drawTextAbsolute(535"This study requires version 8.0 or later."
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"error");
            
    drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp"
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"upgrade");
            return 
    b;
        } else {
            
    true;
        }
        return 
    b;

Working...
X