Would anyone have the ability and interest to alter these formulas to base trade signals on the 0pen-close range during the chart time window instead of the high-low range?
I really want to modify your Vervoot ATR trailing stop formula for intraday use and have determined it would be much more accurate in such a case if the it used the open-close range for the candlestick instead of the high-low range. I can change the code I believe but do not know if there is a function to return the Open value and can not tell from your code what variables are what to know what to modify. Can you assist either with a modified formula or some variable definitions and that get Open value function name?
This question is really intended for Jason Keck as he is the author of the formula in question.
To alter this efs program to calculate the trailing stop values based on the open and close of the bars instead of the high/low values? If so, can anyone suggest the changes?
/***********************************************
Provided By:
eSignal (Copyright c eSignal), a division of Interactive Data
Corporation. 2009. 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:
Average True Range Trailing Stops, by Sylvain Vervoort
Version: 1.0 04/09/2009
Formula Parameters: Default:
ATR Period 5
ATR Multiplication 3.5
Long or Short Long
Show Line Trailing Stop True
Show Labels True
Show Arrows True
Display Cursor Labels True
Line Color Red
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("nATRPeriod", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("ATR Period");
setLowerLimit(1);
setUpperLimit(100);
setDefault(1);
}
fpArray[x] = new FunctionParameter("nATRMultip", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("ATR Multiplication");
setLowerLimit(1);
setUpperLimit(10);
setDefault(1);
}
fpArray[x] = new FunctionParameter("bShowTS", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Line Trailing Stop");
addOption("true");
addOption("false");
setDefault("true");
}
fpArray[x] = new FunctionParameter("bShowL", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Labels");
addOption("true");
addOption("false");
setDefault("true");
}
fpArray[x] = new FunctionParameter("bShowArrows", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Arrows");
addOption("true");
addOption("false");
setDefault("true");
}
fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Display Cursor Labels");
setDefault(true);
}
fpArray[x] = new FunctionParameter("sStrategy", FunctionParameter.STRING);
with(fpArray[x++]){
setName("Long or Short");
addOption("Long");
addOption("Short");
setDefault("Long");
}
fpArray[x] = new FunctionParameter("cColor", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Line Color");
setDefault(Color.red);
}
}
var bInit = false;
var bVersion = null;
var xATRTrailingStop = null;
var xClose = null;
function main(nATRPeriod, nATRMultip, sStrategy, bShowTS, bShowL, bShowArrows, ViewValue, cColor){
var nClose = 0;
var nClose1 = 0;
var nATRTS = 0;
var nATRTS1 = 0;
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
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.BOL D|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.BOL D|Text.LEFT,
null, 13, "upgrade");
return b;
} else {
b = true;
Comment