Announcement

Collapse
No announcement yet.

2016 Jan: Simplify It by James E. Rich and John B. Rich

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

  • 2016 Jan: Simplify It by James E. Rich and John B. Rich

    File Name: Simplify.efs

    Description:
    Simplify It by James E. Rich and John B. Rich

    Formula Parameters:

    Simplify.efs
    ArrowUP: Blue
    ArrowDOWN: Red

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

    Download File:
    Simplify.efs

    Simplify.efs


    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
        Interactive Data Corporation (Copyright ?© 2015) 
        All rights reserved. This sample eSignal Formula Script (EFS)
        is for educational purposes only. Interactive Data Corporation
        reserves the right to modify and overwrite this EFS file with 
        each new release. 

    Description:        
        Simplify by James E. Rich and John B. Rich

    Formula Parameters:                     Default:
        ArrowUP                             Blue
        ArrowDOWN                           Red
    Version:            1.00  11/06/2015

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

    **********************************/

    var fpArray = new Array();

    function 
    preMain(){

        
    setStudyTitle("Simplify");
        
    setPriceStudy(true);
        
        
    setCursorLabelName("50MA"0);
        
    setCursorLabelName("8MA-High"1);
        
    setCursorLabelName("8MA-Low"2);
        
        
    setDefaultBarFgColor(Color.green0);
        
    setDefaultBarFgColor(Color.blue1);
        
    setDefaultBarFgColor(Color.red2);
        
        
    setDefaultBarThickness(20);
        
    setDefaultBarThickness(11);
        
    setDefaultBarThickness(12);
        
        var 
    0;
        
        
    fpArray[x] = new FunctionParameter("ArrowUP"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
            
    setDefault(Color.blue);
        }

        
    fpArray[x] = new FunctionParameter("ArrowDOWN"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
            
    setDefault(Color.red);
        }
    }

    var 
    bVersion null;
    var 
    xMA50 null;
    var 
    xMA8H null;
    var 
    xMA8L null;
    var 
    xClose null;
    var 
    nTrend 0;
    var 
    nTrend_1 0;
    var 
    nBarCounter 0;

    function 
    main(ArrowUPArrowDOWN){

        if (
    bVersion == null
            
    bVersion verify();
        
        if (
    bVersion == false
            return;
        
        if(
    getBarState() == BARSTATE_ALLBARS){
            
    nTrend 0;
            
    nTrend_1 0;
            
    xMA50 sma(50);
            
    xMA8H sma(8high());
            
    xMA8L sma(8low());
            
    xClose close();
        }
        
        var 
    nMA50 xMA50.getValue(0);
        var 
    nMA8H xMA8H.getValue(0);
        var 
    nMA8L xMA8L.getValue(0);
        var 
    nClose xClose.getValue(0);

        if (
    nMA50 == null || nMA8H == null || nMA8L == null || nClose == null )
            return;
        
        if(
    getBarState() == BARSTATE_NEWBAR){
            
    nTrend_1 nTrend;
            
    nBarCounter getCurrentBarCount();
        }
        
        if(
    nTrend_1 == 0){
            if(
    nClose nMA8H){
                
    nTrend_1 1;
                
    drawShape(Shape.UPARROWBelowBar2ArrowUP"UP"+nBarCounter);
            }
            if(
    nClose nMA8L){
                
    nTrend_1 = -1;
                
    drawShape(Shape.DOWNARROWAboveBar2ArrowDOWN"DN"+nBarCounter);
            }
        }

        if(
    nTrend_1 != 1){
            if(
    nClose nMA8H){
                
    drawShape(Shape.UPARROWBelowBar2ArrowUP"UP"+nBarCounter);
                
    nTrend 1;
            }else{
                
    removeShape("UP"+nBarCounter);
                
    nTrend nTrend_1;
            }
        }

        if(
    nTrend_1 != -1){
            if(
    nClose nMA8L){
                
    drawShape(Shape.DOWNARROWAboveBar2ArrowDOWN"DN"+nBarCounter);
                
    nTrend = -1;
            }else{
                
    removeShape("DN"+nBarCounter);
                
    nTrend nTrend_1;
            }
        }

        return [
    nMA50nMA8HnMA8L];
    }

    function 
    verify(){
        var 
    false;
        
        if (
    getBuildNumber() < 3742){
            
    drawTextAbsolute(535"This study requires version 12.1 or later."
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"error");
            
    drawTextAbsolute(520"Click HERE to [email protected]=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