2011 Jul: A Color-Based System For Short-Term Trading

ICE Data Services -


Kraut_ColoredBars.efs, Kraut_ColoredBarsInd.efs, Kraut_ColoredBarsIndWL.efs  EFSLibrary - Discussion Board
  

File Name: Kraut_ColoredBars.efs, Kraut_ColoredBarsInd.efs, Kraut_ColoredBarsIndWL.efs


Description:
A Color-Based System, Indicator And Watch-List-Indicator For Short-Term Trading


Formula Parameters:
Kraut_ColoredBars.efs
Change POINTS
Lookback 10
Trailing Percent 1

Kraut_ColoredBarsInd.efs
Change POINTS
Lookback 10

Kraut_ColoredBarsIndWL.efs
Change POINTS
Lookback 10



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

Download File:
Kraut_ColoredBars.efs
Kraut_ColoredBarsInd.efs
Kraut_ColoredBarsIndWL.efs






EFS Code:

Kraut_ColoredBars.efs



/*********************************Provided By:      Interactive Data Corporation (Copyright  2010)     All rights reserved. This sample eSignal Formula Script (EFS)    is for educational purposes only. Interactive Data Corporation    reserves the right to modify and overwrite this EFS file with     each new release. 	Description:            A Color-Based System For Short-Term Trading Version:            1.0  16/05/2011Formula Parameters:                     Default:Change                                  POINTSLookback                                10Trailing Percent                        1Notes:    The related article is copyrighted material. If you are not    a subscriber of Stocks & Commodities, please visit 	www.traders.com.**********************************/var fpArray = new Array();var bVersion = null;function preMain(){    setPriceStudy(true);        var x=0;    fpArray[x] = new FunctionParameter("gChange", FunctionParameter.STRING);    with(fpArray[x++])    {	setName("Change");	addOption("POINTS");	addOption("PERCENT");        setDefault("POINTS");    }         fpArray[x] = new FunctionParameter("gLookBack", FunctionParameter.NUMBER);    with(fpArray[x++])    {	setName("Lookback");	setLowerLimit(1);        setDefault(10);    }     fpArray[x] = new FunctionParameter("gTrailing", FunctionParameter.NUMBER);    with(fpArray[x++])    {	setName("Trailing Percent");	setLowerLimit(1);	setUpperLimit(100);        setDefault(1);    }    }var bInit = false;var xCls = null;var xVol = null;var xChgCls = null;var xChgVol = null;var xDay = null;var xMonth = null;var xYear = null;var stop = 0; function main(gChange, gLookBack, gTrailing){    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;         if  ( getCurrentBarIndex() == 0 ) return ;        if (!bInit)    {        xCls = close();        xVol = volume();                if (gChange == "POINTS" )        {            xChgCls = mom(gLookBack);            xChgVol = mom(gLookBack, xVol);        }        else{            xChgCls = roc(gLookBack);            xChgVol = roc(gLookBack, xVol);            }        bInit = true;    }                var vChgCls = xChgCls.getValue(0);    var vChgVol = xChgVol.getValue(0);    var vCls0 = xCls.getValue(0);    var vCls1 = xCls.getValue(-1);        if ( vChgCls == null ) return;    var cond = 0;    if ( vChgCls > 0 && vChgVol > 0 )     {        setBarFgColor(Color.green);         cond = 0;    }    if ( vChgCls > 0 && vChgVol < 0 )     {        setBarFgColor(Color.blue);         cond = 1;    }     if ( vChgCls < 0 && vChgVol < 0 )     {        setBarFgColor(Color.RGB(255, 106, 0));         cond = 2;    };    if ( vChgCls < 0 && vChgVol > 0 )     {        setBarFgColor(Color.red);         cond = 3;    };          if ( Strategy.isLong() )    {            if ( vCls0 <= stop )             {                  Strategy.doSell( "Close Long", Strategy.CLOSE, Strategy.THISBAR );                stop = 0;            }            else             {                    if (vCls0 > vCls1)  stop = vCls0 * (1- gTrailing / 100);             }        }    else    {            if ( cond == 0 || cond == 1  )  Strategy.doLong("Entry Long", Strategy.CLOSE, Strategy.THISBAR);    }        if ( Strategy.isLong() ) setBarBgColor (Color.darkgreen);}function verify() {    var b = false;    if (getBuildNumber() < 779) {        drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "error");        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "upgrade");        return b;    } else {        b = true;    }    return b;}

Kraut_ColoredBarsInd.efs

/*********************************Provided By:      Interactive Data Corporation (Copyright  2010)     All rights reserved. This sample eSignal Formula Script (EFS)    is for educational purposes only. Interactive Data Corporation    reserves the right to modify and overwrite this EFS file with     each new release. 	Description:            A Color-Based Indicator For Short-Term Trading Version:            1.0  16/05/2011Formula Parameters:                     Default:Change                                  POINTSLookback                                10      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();var bVersion = null;function preMain(){    setCursorLabelName("Price Zone Analyzer", 0);    setPlotType(PLOTTYPE_HISTOGRAM,0);        var x=0;    fpArray[x] = new FunctionParameter("gChange", FunctionParameter.STRING);    with(fpArray[x++])    {	setName("Change");	addOption("POINTS");	addOption("PERCENT");        setDefault("POINTS");    }    fpArray[x] = new FunctionParameter("gLookBack", FunctionParameter.NUMBER);    with(fpArray[x++])    {	setName("Lookback");	setLowerLimit(1);        setDefault(10);    }}var bInit = false;var xVol = null;var xChgCls = null;var xChgVol = null;function main(gChange, gLookBack){    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;                 if (!bInit)    {        xVol = volume();            if (gChange == 'POINTS')        {            xChgCls = mom(gLookBack);            xChgVol = mom(gLookBack,xVol);        }        else        {            xChgCls = roc(gLookBack);            xChgVol = roc(gLookBack,xVol);        }        bInit = true;    }    var vVol = xVol.getValue(0);    var vChgCls = xChgCls.getValue(0);    var vChgVol = xChgVol.getValue(0);        if ( vChgCls == null ) return;        if ( vChgCls > 0 && vChgVol > 0 ) setBarFgColor(Color.green);    if ( vChgCls > 0 && vChgVol < 0 ) setBarFgColor(Color.blue);      if ( vChgCls < 0 && vChgVol < 0 ) setBarFgColor(Color.RGB(255, 106, 0));    if ( vChgCls < 0 && vChgVol > 0 ) setBarFgColor(Color.red);              return vVol;}function verify() {    var b = false;    if (getBuildNumber() < 779) {        drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "error");        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "upgrade");        return b;    } else {        b = true;    }    return b;}

Kraut_ColoredBarsIndWL.efs

/*********************************Provided By:      Interactive Data Corporation (Copyright  2010)     All rights reserved. This sample eSignal Formula Script (EFS)    is for educational purposes only. Interactive Data Corporation    reserves the right to modify and overwrite this EFS file with     each new release. 	Description:            A Color-Based Indicator For Short-Term Trading For WL Version:            1.0  16/05/2011Formula Parameters:                     Default:Change                                  POINTSLookback                                10Notes:    The related article is copyrighted material. If you are not    a subscriber of Stocks & Commodities, please visit 	www.traders.com.**********************************/var fpArray = new Array();var bVersion = null;function preMain(){    setCursorLabelName("Date P2", 0);    setCursorLabelName("P2", 1);    setCursorLabelName("Vol2", 2);    setCursorLabelName("Date P1", 3);    setCursorLabelName("P1", 4);    setCursorLabelName("Vol1", 5);    setCursorLabelName("Price Delta", 6);    setCursorLabelName("Vol Delta", 7);    setCursorLabelName("Price Delta, %", 8);    setCursorLabelName("Vol Delta, %", 9);    setCursorLabelName("Color", 10);            var x=0;    fpArray[x] = new FunctionParameter("gChange", FunctionParameter.STRING);    with(fpArray[x++])    {	setName("Change");	addOption("POINTS");	addOption("PERCENT");        setDefault("POINTS");    }        fpArray[x] = new FunctionParameter("gLookBack", FunctionParameter.NUMBER);    with(fpArray[x++])    {	setName("Lookback");	setLowerLimit(1);        setDefault(10);    }    }var bInit = false;var xVol = null;var xCls = null;var xMomCls = null;var xMomVol = null;var xRocCls = null;var xRocVol = null;var xDay = null;var xMonth = null;var xYear = null;function main(gChange, gLookBack){    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;         if (!bInit)    {        xCls = close();        xVol = volume();        xRocCls = roc(gLookBack);        xRocVol = roc(gLookBack, xVol);        xMomCls = mom(gLookBack);        xMomVol = mom(gLookBack, xVol);        xDay = day();        xMonth = month();        xYear = year();                bInit = true;    }            var vCls = xCls.getValue(0);    var vVol = xVol.getValue(0);    var vClsPrev = xCls.getValue(-gLookBack);    var vVolPrev = xVol.getValue(-gLookBack);    var vMomCls = xMomCls.getValue(0);    var vMomVol = xMomVol.getValue(0);    var vRocCls = xRocCls.getValue(0);    var vRocVol = xRocVol.getValue(0);    if ( vClsPrev == null ) return;    var vP2Day = ""+xMonth.getValue(0)+"/"+xDay.getValue(0)+"/"+xYear.getValue(0);    var vP1Day = ""+xMonth.getValue(-gLookBack)+"/"+xDay.getValue(-gLookBack)+"/"+xYear.getValue(-gLookBack);    var vChgCls = (gChange=='POINTS')? vMomCls : vRocCls;    var vChgVol = (gChange=='POINTS')? vMomVol : vRocVol;     var vColor = "na";    if ( vChgCls >= 0 && vChgVol >= 0 )     {        setBarBgColor(Color.green,10);         vColor = "GREEN"    };    if ( vChgCls >= 0 && vChgVol <= 0 )     {        setBarBgColor(Color.blue, 10);         vColor = "BLUE"    };      if ( vChgCls <= 0 && vChgVol <= 0 )     {        setBarBgColor(Color.RGB(255, 106, 0), 10);         vColor = "ORANGE"    };    if ( vChgCls <= 0 && vChgVol >= 0 )     {        setBarBgColor(Color.red, 10);         vColor = "RED"    };              return new Array (vP2Day, vCls, vVol, vP1Day, vClsPrev, 		vVolPrev, Math.abs(vMomCls), Math.abs(vMomVol), Math.abs(vRocCls), Math.abs(vRocVol), vColor);    }function verify() {    var b = false;    if (getBuildNumber() < 779) {        drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "error");        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",             Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,            null, 13, "upgrade");        return b;    } else {        b = true;    }    return b;}