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:
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 x = 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(Trigger, InitStop){
if (bVersion == null) bVersion = 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(0, BottomRow1, "Suggested Long Entry at " + formatPriceNumber(nEntryPrice + Trigger), Color.green, null,
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(4, xLow).getValue(-1);
var nHighest = xHigh.getValue(-1);
drawLineRelative(-4, nHighest, -1, nHighest, PS_DOT, 2, cBoxColor, "lineH"+rawtime(0));
drawLineRelative(-4, nLowest, -1, nLowest, PS_DOT, 2, cBoxColor, "lineL"+rawtime(0));
drawLineRelative(-4, nHighest, -4, nLowest, PS_DOT, 2,cBoxColor, "line1V"+rawtime(0));
drawLineRelative(-1, nHighest, -1, nLowest, PS_DOT, 2, cBoxColor, "line2V"+rawtime(0));
}
}
if (bIsLong){
if (nHigh > vHighestHigh && (nLow - InitStop) > vStopPrice) {
vStopPrice = (nLow - InitStop);
vHighestHigh = nHigh
}
else if (nLow <= vStopPrice){
drawTextRelative(0, AboveBar1, "\u00EA", Color.red, null, Text.PRESET|Text.CENTER, "Wingdings", 10, "Exit"+rawtime(0));
drawTextRelative(0, TopRow1, "Suggested Long Exit at "+formatPriceNumber(vStopPrice), Color.red, null,
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(0, BelowBar1, "\u00E9", Color.green, null, Text.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 b = false;
if (getBuildNumber() < 779){
drawTextAbsolute(5, 35, "This study requires version 10.6 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;
}