Announcement

Collapse
No announcement yet.

2017 Mar: Golden Cross Breakouts by Ken Calhoun

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

  • 2017 Mar: Golden Cross Breakouts by Ken Calhoun

    File Name: GoldenCrossBkout.efs

    Description:
    Golden Cross Breakouts by Ken Calhoun

    Formula Parameters:

    GoldenCrossBkout.efs

    Fast MA Length: 50
    Slow MA Length: 200
    Trailing Stop: 2.0

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

    Download File:
    GoldenCrossBkout.efs

    GoldenCrossBkout.efs


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

    Version:            1.00  01/10/2017

    Formula Parameters:                     Default:
    Fast MA Length                          50
    Slow MA Length                          200
    Trailing Stop                           2.0


    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);
        
    setStudyTitle("Golden Cross Breakouts");

        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarFgColor(Color.green1);

        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("FastMALen"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);
            
    setDefault(50);
            
    setName("Fast Average");
        }
        
    fpArray[x] = new FunctionParameter("SlowMALen"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);
            
    setDefault(200);
            
    setName("Slow Average");
        }
        
    fpArray[x] = new FunctionParameter("TrlStop"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(0.01);        
            
    setDefault(2.0);
            
    setName("Trailing Stop");
        }
    }

    var 
    bVersion null;
    var 
    bInit false;
    var 
    xFastMA null;
    var 
    xSlowMA null;
    var 
    xHigh null;
    var 
    xLow null;
    var 
    bIsLong false;
    var 
    vHighestHigh null;
    var 
    vStopPrice null;

    function 
    main(FastMALenSlowMALenTrlStop){

        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;

        if(
    getBarState() == BARSTATE_ALLBARS){
            
    setCursorLabelName("SMA("+FastMALen+")"0);
            
    setCursorLabelName("SMA("+SlowMALen+")"1);
            
    bInit false;
        }

        if (!
    bInit){
            
    xFastMA sma(FastMALen);
            
    xSlowMA sma(SlowMALen)
            
    xHigh high();
            
    xLow low();
            
    bIsLong false;
            
    bInit true;
        }

        var 
    nLow xLow.getValue(0);
        var 
    nHigh xHigh.getValue(0);
        var 
    nFastMA xFastMA.getValue(0);
        var 
    nFastMA1 xFastMA.getValue(-1);
        var 
    nSlowMA xSlowMA.getValue(0);
        var 
    nSlowMA1 xSlowMA.getValue(-1);

        if(
    nSlowMA1 == null) return;

        if (
    bIsLong){
            if (
    nHigh vHighestHigh && (nLow TrlStop) > vStopPrice) {
                
    vStopPrice = (nLow TrlStop);
                
    vHighestHigh nHigh
            
    }
            else if (
    nLow <= vStopPrice){
                
    bIsLong 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 (
    nFastMA nSlowMA && nFastMA1 <= nSlowMA1) {
            
    drawTextRelative(0BelowBar1"\u00E9"Color.greennullText.PRESET|Text.CENTER"Wingdings"10"Long"+rawtime(0));
            
    drawText("Suggested Long Entry at "+formatPriceNumber(close(0)),TopRow1,Color.green,Text.LEFT,"Text"+rawtime(0));
            
    bIsLong true;
            
    vStopPrice = (nLow TrlStop);
            
    vHighestHigh nHigh;
        }

        return [
    nFastMAnSlowMA];
    }

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