Hi,
i am looking for a code, that adds a special condition to the code of the highest high study.
The condition should be, that the highest high(-1) before the highest high(0) should be a peak with a left and right leg of 10 bars with lower bars.
Is thsi possible? How to change the code below?
Thanks
/************************************************** **************************************************
Copyright © eSignal, a division of Interactive Data Corporation. 2005. All rights reserved.
This sample eSignal Formula Script (EFS) may be modified and saved under a new
filename; however, eSignal is no longer responsible for the functionality once modified.
eSignal reserves the right to modify and overwrite this EFS file with each new release.
************************************************** ************************************************** */
function preMain() {
setPriceStudy(true);
setCursorLabelName("Highest High");
var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
fp1.setName("Number of Bars");
fp1.setLowerLimit(1);
fp1.setDefault(20);
}
function main(nInputLength) {
if(high(-nInputLength) == null) return;
var i = 0;
var hh = null;
for(i = 0; i < nInputLength; i++) {
if(i == 0) {
hh = high(i);
} else {
hh = Math.max(hh, high(-i));
}
}
return hh;
}
i am looking for a code, that adds a special condition to the code of the highest high study.
The condition should be, that the highest high(-1) before the highest high(0) should be a peak with a left and right leg of 10 bars with lower bars.
Is thsi possible? How to change the code below?
Thanks
/************************************************** **************************************************
Copyright © eSignal, a division of Interactive Data Corporation. 2005. All rights reserved.
This sample eSignal Formula Script (EFS) may be modified and saved under a new
filename; however, eSignal is no longer responsible for the functionality once modified.
eSignal reserves the right to modify and overwrite this EFS file with each new release.
************************************************** ************************************************** */
function preMain() {
setPriceStudy(true);
setCursorLabelName("Highest High");
var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
fp1.setName("Number of Bars");
fp1.setLowerLimit(1);
fp1.setDefault(20);
}
function main(nInputLength) {
if(high(-nInputLength) == null) return;
var i = 0;
var hh = null;
for(i = 0; i < nInputLength; i++) {
if(i == 0) {
hh = high(i);
} else {
hh = Math.max(hh, high(-i));
}
}
return hh;
}
Comment