3-Bar-Reversal-Pattern Strategy

ICE Data Services -

3BarReversal.efs  
EFSLibrary - Discussion Board  

File Name: 3BarReversal.efs

Description:
3-Bar-Reversal-Pattern Strategy

Formula Parameters:

Notes:

This startegy based on 3-day pattern reversal described in "Are Three-Bar Patterns Reliable For Stocks?" article by Thomas Bulkowski, presented in January,2000 issue of Stocks&Commodities magazine.
That pattern conforms to the following rules:

  • It uses daily prices, not intraday or weekly prices;
  • The middle day of the three-day pattern has the lowest low of the three days, with no ties allowed;
  • The last day must have a close above the prior day's high, with no ties allowed;
  • Each day must have a nonzero trading range.

Download File:
3BarReversal.efs


EFS 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:        

    3-Bar-Reversal-Pattern Strategy

Version:            1.0  09/25/2008

Notes: 
    This startegy based on 3-day pattern reversal described in "Are Three-Bar 
    Patterns Reliable For Stocks?" article by Thomas Bulkowski, presented in 
    January,2000 issue of Stocks&Commodities magazine.

    That pattern conforms to the following rules:

    - It uses daily prices, not intraday or weekly prices;
    - The middle day of the three-day pattern has the lowest low of the three days, with no ties allowed;
    - The last day must have a close above the prior day's high, with no ties allowed;
    - Each day must have a nonzero trading range. 

Formula Parameters:                     Default:

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

function preMain() {

    setPriceStudy(true);
    setStudyTitle("3BR");
    setCursorLabelName("3BR");
    
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.black);
}





function main() { 

    if(getCurrentBarIndex() == 0) return;
    
    if (!Strategy.isLong()) {
        if(open(-2) > close(-2) && high(-1) < high(-2) && low(-1) < low(-2) && low(0) > low(-1) && high(0) > high(-1) + 0.25) {
            Strategy.doLong("Long", Strategy.CLOSE, Strategy.THISBAR);
        }
    }

    if (!Strategy.isShort()) {
        if(open(-2) < close(-2) && high(-1) > high(-2) && low(-1) > low(-2) && high(0) < high(-1) && low(0) < low(-1) + 0.25) {
            Strategy.doShort("Short", Strategy.CLOSE, Strategy.THISBAR);
		}
	}



	if(Strategy.isLong())
        setPriceBarColor(Color.lime);

	if(Strategy.isShort())
        setPriceBarColor(Color.red);

    return;

}