Announcement

Collapse
No announcement yet.

2016 Apr: Trading Gap Reversals by Ken Calhoun

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

  • 2016 Apr: Trading Gap Reversals by Ken Calhoun

    File Name: Gap_reversal.efs

    Description:
    Trading Gap Reversals by Ken Calhoun

    Formula Parameters:

    Gap_reversal.efs
    Gap Down: 10
    Trailing Stop: 0.4

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

    Download File:
    Gap_reversal.efs

    Gap_reversal.efs


    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
    eSignal (Copyright c eSignal), a division of Interactive Data 
    Corporation. 2016. 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:        
        Gap Reversals by Ken Calhoun

    Version:            1.00  02/08/2016

    Formula Parameters:                     Default:
    Gap Down                                10
    Trailing Stop                           0.4



    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(){
        
        
    setPriceStudy(true);
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("GapDown"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);
            
    setUpperLimit(100);  
            
    setDefault(10);
            
    setName("Gap Down %");
        }
        
    fpArray[x] = new FunctionParameter("TrlStop"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(0.01);        
            
    setDefault(0.4);
            
    setName("Trailing Stop");
        }
    }

    var 
    bInit false;
    var 
    xClose null;
    var 
    xOpen null;
    var 
    xHigh null;
    var 
    xLow null;
    var 
    bIsLong false;
    var 
    bGapFound false;
    var 
    vStopPrice null;
    var 
    bVersion null;
    var 
    vLowOfTheGap null;
    var 
    vGapDown null;
    var 
    vHighestHigh null;

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

        
        if(
    getBarState() == BARSTATE_ALLBARS){
            
    bInit false;
        }

        if (!
    bInit){
            
    xClose close(inv("D"));
            
    xOpen open(inv("D"));
            
    xHigh high();
            
    xLow low();
            
    bIsLong false;
            
    bGapFound false;
            
    vGapDown GapDown/100;
            
    bInit true;
        }

        if(
    xClose.getValue(-1) == null) return;
        var 
    nPrevClose xClose.getValue(-1);
        var 
    nLow xLow.getValue(0);
        var 
    nHigh xHigh.getValue(0);
        var 
    nOpen xOpen.getValue(0);

        if (
    day(-1) != day(0) && bGapFound) {
            
    bGapFound false;
            
    bIsLong false;
        }

        if (
    bIsLong){
            if (
    nHigh vHighestHigh && (nLow TrlStop) > vStopPrice) {
                
    vStopPrice = (nLow TrlStop);
                
    vHighestHigh nHigh
            
    }
            else if (
    nLow <= vStopPrice){
                
    bIsLong false;
                
    bGapFound false;
                
    drawTextRelative(0AboveBar1"\u00EA"Color.rednullText.PRESET|Text.CENTER"Wingdings"10"Exit"+rawtime(0));
                
    drawText("Suggested Long Exit at "+formatPriceNumber(vStopPrice),BottomRow1,Color.red,Text.LEFT,"Text Exit"+rawtime(0));
            }
        }
        
        if (
    bGapFound && !bIsLong && nHigh vLowOfTheGap) {
            
    drawTextRelative(0BelowBar1"\u00E9"Color.greennullText.PRESET|Text.CENTER"Wingdings"10"Long"+rawtime(0));
            
    drawText("Suggested Long Entry at "+formatPriceNumber(vLowOfTheGap),TopRow1,Color.green,Text.LEFT,"Text"+rawtime(0));
            
    bIsLong true;
            
    vStopPrice = (nLow TrlStop);
            
    vHighestHigh nHigh;
        }

        if( !
    bIsLong && !bGapFound && day(0)!= day(-1) && (nPrevClose nOpen) >= (nPrevClose vGapDown)){
            
    vLowOfTheGap nLow 0.5;
            
    bGapFound true;
        }

        return;
    }

    function 
    verify(){
        var 
    false;
        if (
    getBuildNumber() < 779){
            
            
    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