Announcement

Collapse
No announcement yet.

2007 Mar: Trading Systems and Fractals

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

  • 2007 Mar: Trading Systems and Fractals

    File Name: FDI.efs

    Description:
    This study is based on the March 2007 article, Trading Systems and Fractals, by Radha Panini.

    Formula Parameters:
    Periods: 100

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


    Download File:
    FDI.efs



    EFS Code:
    PHP Code:
    /***************************************
    Provided By : eSignal (c) Copyright 2007
    Description:  Trading Systems and Fractals 
                  by Radha Panini

    Version 1.0  2/22/2007   

    Notes:
    * March 2007 Issue of Stocks and Commodities Magazine
    * Study requires version 8.0 or later.
    * Additional info used for calculating the Hurst exponent using the
        Rescaled Range Analysis technique can be found at the following
        URLs:
            [url]http://www.complexity.org.au/ci/vol05/sevcik/sevcik.html[/url]

    Formula Parameters:                     Default:
    Periods                                 100
    *****************************************/


    function preMain() {
        
    setStudyTitle("Fractal Dimension Index ");
        
    setDefaultBarFgColor(Color.red);
        
    setDefaultBarThickness(2);
        
    setCursorLabelName("FDI");
        
    addBand(1.5PS_SOLID2Color.blue"middle");
        
        var 
    fp1 = new FunctionParameter("nPeriods"FunctionParameter.NUMBER);
            
    fp1.setName("Periods");
            
    fp1.setLowerLimit(1);
            
    fp1.setDefault(100);
    }

    // Global Variables
    var bVersion  null;    // Version flag
    var bInit     false;   // Initialization flag

    var xMax null;
    var 
    xMin null;
    var 
    nNum 0;
    var 
    nNum_1 0;

    function 
    main(nPeriods) {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;    

        
    //Initialization
        
    if (bInit == false) {
            
    xMax upperDonchian(nPeriodsclose());
            
    xMin lowerDonchian(nPeriodsclose());
            
    bInit true;
        }
        
        var 
    nMax xMax.getValue(0);
        var 
    nMin xMin.getValue(0);
        if (
    nMax == null || nMin == null) return;
        
        var 
    nState getBarState();
        var 
    nFDI 0;  
        var 
    nLength 0;
        
        
    nNum_1 0;
        
        for (var 
    0nPeriodsi++) {
            if (
    nMax nMin 0) {
                
    nNum = (close(-i) - nMin) / (nMax nMin);
                if (
    0) {
                    
    nLength += Math.sqrt(Math.pow((nNum nNum_1), 2) + (1/Math.pow(nPeriods ,2)));
                    
    nNum_1 nNum;
                }
            }
        }
        
        if (
    nLength 0) {
            
    nFDI + (Math.log(nLength) + Math.log(2)) / Math.log(2*nPeriods);
        }
        
        return 
    nFDI;
    }


    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;

    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
Working...
X