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:
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(GapDown, TrlStop){
if (bVersion == null) bVersion = 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(0, AboveBar1, "\u00EA", Color.red, null, Text.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(0, BelowBar1, "\u00E9", Color.green, null, Text.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 b = false;
if (getBuildNumber() < 779){
drawTextAbsolute(5, 35, "This study requires version 12.1 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;
}