Announcement

Collapse
No announcement yet.

2017 Nov: Swing Trading Four-Day Breakouts by Ken Calhoun

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2017 Nov: Swing Trading Four-Day Breakouts by Ken Calhoun

    File Name: 4Day_Breakouts.efs

    Description:
    Swing Trading Four-Day Breakouts by Ken Calhoun

    Formula Parameters:

    4Day_Breakouts.efs

    Trigger: 0.5
    Initial Stop: 2

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

    Download File:
    4Day_Breakouts.efs

    4Day_Breakouts.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:        
        Swing Trading Four-Day Breakouts by Ken Calhoun

    Version:            1.00  09/12/2017

    Formula Parameters:                     Default:
    Trigger                                 0.5
    Initial Stop                            2



    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);
        
    setShowCursorLabel(false);
        
    setDefaultBarFgColor(Color.black);

        var 
    0;
        
    fpArray[x] = new FunctionParameter("Trigger"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(0.000001);
            
    setDefault(0.5);
            
    setName("Trigger");
        }
        
    fpArray[x] = new FunctionParameter("InitStop"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(0.000001);        
            
    setDefault(2);
            
    setName("Initial Stop");
        }
    }

    var 
    bInit false;
    var 
    bVersion null;
    var 
    xHigh null;
    var 
    xLow null;
    var 
    xOpen null;
    var 
    xClose null;

    var 
    bSeqFound false;
    var 
    bIsLong false;
    var 
    vStopPrice null;
    var 
    vHighestHigh null;
    var 
    nEntryPrice null;

    var 
    nRedBarCount 1;
    var 
    sReturnVal " ";

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

        if (
    getBarState() == BARSTATE_ALLBARS){

            
    bInit false;
        }

        if (!
    bInit){
            
    nRedBarCount 1;
            
    bSeqFound false;
            
    bIsLong false;
            
    vStopPrice null;
            
    vHighestHigh null;
            
    nEntryPrice null;
            
    sReturnVal " ";
            
    xLow low();
            
    xHigh high();
            
    xOpen open();
            
    xClose close();
            
    bInit true;
        }

        var 
    nHigh xHigh.getValue(0);
        var 
    nLow xLow.getValue(0);

        if (
    getBarState() == BARSTATE_NEWBAR){

            if ( 
    xClose.getValue(-1) < xOpen.getValue(-1) )
                
    nRedBarCount++;

            if (
    xClose.getValue(-1) > xOpen.getValue(-1) &&
                
    xClose.getValue(-2) > xOpen.getValue(-2) &&
                
    xClose.getValue(-3) > xOpen.getValue(-3) &&
                
    xClose.getValue(-4) > xOpen.getValue(-4) &&

                
    xHigh.getValue(-1) > xHigh.getValue(-2) &&
                
    xHigh.getValue(-2) > xHigh.getValue(-3) &&
                
    xHigh.getValue(-3) > xHigh.getValue(-4) &&

                
    nRedBarCount 0){
                    var 
    cBoxColor Color.green;

                    if (!
    bIsLong){

                        
    bSeqFound true;
                        
    nEntryPrice xHigh.getValue(-1);

                        
    drawTextRelative(0BottomRow1"Suggested Long Entry at " formatPriceNumber(nEntryPrice Trigger), Color.greennull,
                                            
    Text.PRESET|Text.LEFT|Text.BOLD"Arial"8"Entry text"+rawtime(0));

                        
    sReturnVal "Suggested Long at " formatPriceNumber(nEntryPrice Trigger);
                    }
                    else 
    cBoxColor Color.RGB(101,209,112);

                    
    nRedBarCount 0;
                    var 
    nLowest llv(4xLow).getValue(-1);
                    var 
    nHighest xHigh.getValue(-1);
                    
    drawLineRelative(-4nHighest, -1nHighestPS_DOT2cBoxColor"lineH"+rawtime(0));
                    
    drawLineRelative(-4nLowest, -1nLowestPS_DOT2cBoxColor"lineL"+rawtime(0));
                    
    drawLineRelative(-4nHighest, -4nLowestPS_DOT2,cBoxColor"line1V"+rawtime(0));
                    
    drawLineRelative(-1nHighest, -1nLowestPS_DOT2cBoxColor"line2V"+rawtime(0));
                }
        }

         if (
    bIsLong){
            if (
    nHigh vHighestHigh && (nLow InitStop) > vStopPrice) {
                
    vStopPrice = (nLow InitStop);
                
    vHighestHigh nHigh
            
    }
            else if (
    nLow <= vStopPrice){
                
    drawTextRelative(0AboveBar1"\u00EA"Color.rednullText.PRESET|Text.CENTER"Wingdings"10"Exit"+rawtime(0));
                
    drawTextRelative(0TopRow1"Suggested Long Exit at "+formatPriceNumber(vStopPrice), Color.rednull,
                                
    Text.PRESET|Text.LEFT|Text.BOLD"Arial"8"Exit text"+rawtime(0));
                
    bIsLong false;
                
    bSeqFound false;
                
    nRedBarCount 1;
                
    sReturnVal " ";
            }
        }

        if (
    bSeqFound && !bIsLong && nHigh >= nEntryPrice Trigger){
            
    drawTextRelative(0BelowBar1"\u00E9"Color.greennullText.PRESET|Text.CENTER"Wingdings"10"Entry"+rawtime(0));

            
    bSeqFound false;
            
    bIsLong true;
            
    vStopPrice = (nLow InitStop);
            
    vHighestHigh nHigh;
            
    sReturnVal " ";
        }

        if (
    isWatchList()){
            if (
    sReturnVal != " "setBarBgColor(Color.RGB(157,255,162));

            return 
    sReturnVal;
        }

    }



    function 
    verify(){
        var 
    false;
        if (
    getBuildNumber() < 779){

            
    drawTextAbsolute(535"This study requires version 10.6 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;

Working...
X