Hi I try to make the following .efs, Trailing Stop p15, with inv(1).
I made some changes but still not working what do I do wrong? Any Ideas
Elias
............
/************************************************** ***************
Provided By : eSignal (c) Copyright 2004
Description: Volatility Trailing Stop P15 - by Jim Berg
Version 1.0
Notes:
February 2005 Issue - "The Truth About Volatility"
Formula Parameters: Defaults:
ATR Periods 10
Thickness 2
************************************************** ***************/
function preMain() {
setPriceStudy(true);
setStudyTitle("AAA_Volatility Trailing Stop P15 ");
setCursorLabelName("VStop", 0);
setDefaultBarThickness(2, 0);
setDefaultBarFgColor(Color.red, 0);
setShowTitleParameters(false);
// Formula Parameters
var fp1 = new FunctionParameter("nATRlen", FunctionParameter.NUMBER);
fp1.setName("ATR Periods");
fp1.setLowerLimit(1);
fp1.setDefault(10);
// Study Parameters
var sp1 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
sp1.setName("Thickness");
sp1.setDefault(2);
}
var bEdit = true;
var vATR = null;
var aStop = new Array(15,inv(1));
function main(nATRlen, nThick) {
if (bEdit == true) {
vATR = new ATRStudy(nATRlen);
setDefaultBarThickness(nThick, 0);
bEdit = false;
}
var nState = getBarState();
if (nState == BARSTATE_NEWBAR) {
aStop.pop();
aStop.unshift(0);
}
var ATR = vATR.getValue(0);
if (ATR == null) return;
var c = close();
var vStop = (c - (2*ATR));
aStop[0] = vStop;
var vStop15 = vStop;
for (var i = 0; i < 15; i++) {
vStop15 = Math.max(aStop[i], vStop15);
}
return vStop15;
}
I made some changes but still not working what do I do wrong? Any Ideas
Elias
............
/************************************************** ***************
Provided By : eSignal (c) Copyright 2004
Description: Volatility Trailing Stop P15 - by Jim Berg
Version 1.0
Notes:
February 2005 Issue - "The Truth About Volatility"
Formula Parameters: Defaults:
ATR Periods 10
Thickness 2
************************************************** ***************/
function preMain() {
setPriceStudy(true);
setStudyTitle("AAA_Volatility Trailing Stop P15 ");
setCursorLabelName("VStop", 0);
setDefaultBarThickness(2, 0);
setDefaultBarFgColor(Color.red, 0);
setShowTitleParameters(false);
// Formula Parameters
var fp1 = new FunctionParameter("nATRlen", FunctionParameter.NUMBER);
fp1.setName("ATR Periods");
fp1.setLowerLimit(1);
fp1.setDefault(10);
// Study Parameters
var sp1 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
sp1.setName("Thickness");
sp1.setDefault(2);
}
var bEdit = true;
var vATR = null;
var aStop = new Array(15,inv(1));
function main(nATRlen, nThick) {
if (bEdit == true) {
vATR = new ATRStudy(nATRlen);
setDefaultBarThickness(nThick, 0);
bEdit = false;
}
var nState = getBarState();
if (nState == BARSTATE_NEWBAR) {
aStop.pop();
aStop.unshift(0);
}
var ATR = vATR.getValue(0);
if (ATR == null) return;
var c = close();
var vStop = (c - (2*ATR));
aStop[0] = vStop;
var vStop15 = vStop;
for (var i = 0; i < 15; i++) {
vStop15 = Math.max(aStop[i], vStop15);
}
return vStop15;
}
Comment