File Name: ABillW_FractalLine.efs

Description:
Bill Williams. FractalLine

Formula Parameters:
Strength: 2

Notes:
According to Bill Williams, one should enter the market after the new price
top (for long positions) or bottom (for short positions) has been broken
through. The identification here is based on defining the genuine fractal
formation; an upward fractal is detected if there is a row (at least three)
increasing values and after the local top has been achieved, bars (at least
two bars) show a constant descent. So the model requires at least 5 bars of
which the middle one is the local top (upward fractal) or the local bottom
(downward fractal) Entry orders according to this concept are usually posted
as stop orders activated after the price breaks through a preset level, where
the identification of the market`s leaving the previous price corridor takes place.
This indicator displays such levels, relative to which one decided whether the
price has broken out of the previous corridor.


Download File:
ABillW_FractalLine.efs



EFS Code:
PHP Code:
/*********************************
Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2008. 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:        
    Bill Williams. FractalLine

Version:            1.0  10/14/2008

Notes:
    According to Bill Williams, one should enter the market after the new price 
    top (for long positions) or bottom (for short positions) has been broken 
    through. The identification here is based on defining the genuine fractal 
    formation; an upward fractal is detected if there is a row (at least three) 
    increasing values and after the local top has been achieved, bars (at least 
    two bars) show a constant descent. So the model requires at least 5 bars of 
    which the middle one is the local top (upward fractal) or the local bottom 
    (downward fractal) Entry orders according to this concept are usually posted 
    as stop orders activated after the price breaks through a preset level, where 
    the identification of the market`s leaving the previous price corridor takes place.
    This indicator displays such levels, relative to which one decided whether the 
    price has broken out of the previous corridor. 

Formula Parameters:                     Default:
    Strength                               2

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

var fpArray = new Array();

function 
preMain() {
    
setPriceStudy(true);
   
    
setStudyTitle("FractalLine");
    
setCursorLabelName("BuyFractal"0);
    
setCursorLabelName("SellFractal"1);
    
setDefaultBarFgColor(Color.blue0);
    
setDefaultBarFgColor(Color.red1); 
    
    var 
x=0;
    
fpArray[x] = new FunctionParameter("Strength"FunctionParameter.NUMBER);
    
with(fpArray[x++]){
        
setLowerLimit(1);        
        
setDefault(2);
    }
}

function 
main(Strength) {
var 
nBarState getBarState();
var 
Price 0;
var 
SwingLow 0
var 
SwingHigh 0;
var 
Strength;
var 
Found false;
var 
Counter 0;
var 
0;
var 
Truth false;

    
    if(
nBarState == BARSTATE_ALLBARS) {
        if (
Strength == nullStrength 2;
    }  

    for (
Strength;(80)&&(Found == false); J++)
    {
        
Price low(-J);
        
1;
        
Truth true;
        for (
= (1); ((J) <= Strength)&&(Truth); X++)
        {
            if (
Price low(-X)) Truth false;
        }
        
1;
        for (
= (1);((X) <= Strength)&&(Truth); X--)
        {
            if (
Price >= low(-X)) Truth false;
        }
        if (
TruthCounter++;
        if (
Counter >= 1Found true;
    }
    if (
FoundSwingLow Price;
    else 
SwingLow = -1;
    
Strength;
    
Found false;
    
Counter 0;
    for (
Strength;(80)&&(Found == false); J++)
    {
        
Price high(-J);
        
1;
        
Truth true;
        for (
= (1); ((J) <= 2)&&(Truth); X++)
        {
            if (
Price high(-X)) Truth false;
        }
        
1;
        for (
= (1);((X) <= 2)&&(Truth); X--)
        {
            if (
Price <= high(-X)) Truth false;
        }
        if (
TruthCounter++;
        if (
Counter >= 1Found true;
    }
    if (
FoundSwingHigh Price;
    else 
SwingHigh = -1;
    var 
Res1 null;
    var 
Res2 null;
    if (
SwingHigh > -1Res1 SwingHigh;
    if (
SwingLow > -1Res2 SwingLow;
    return new Array(
Res1Res2);