File Name: HigherH_LowerL.efs
Description:
Higher Highs & Lower Lows by Vitali Apirine
Formula Parameters:
HigherH_LowerL.efs
Highest/Lowest Lookback: 20
Average Length: 20
Overbought Level: 60
Oversold Level: 10
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
HigherH_LowerL.efs
HigherH_LowerL.efs
EFS Code:
Description:
Higher Highs & Lower Lows by Vitali Apirine
Formula Parameters:
HigherH_LowerL.efs
Highest/Lowest Lookback: 20
Average Length: 20
Overbought Level: 60
Oversold Level: 10
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
HigherH_LowerL.efs
HigherH_LowerL.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
Interactive Data Corporation (Copyright 2015)
All rights reserved. This sample eSignal Formula Script (EFS)
is for educational purposes only. Interactive Data Corporation
reserves the right to modify and overwrite this EFS file with
each new release.
Description:
Higher Highs & Lower Lows by Vitali Apirine
Formula Parameters: Default:
Highest/Lowest Lookback 20
Average Length 20
Overbought Level 60
Oversold Level 10
Version: 1.00 12/05/2015
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(false);
setStudyTitle("Higher Highs & Lower Lows");
setCursorLabelName("HHS",0);
setCursorLabelName("LLS",1);
setDefaultBarFgColor(Color.RGB(0,148,255),0);
setDefaultBarFgColor(Color.RGB(255,155,0),1);
var x=0;
fpArray[x] = new FunctionParameter("Lookback", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Highest/Lowest Lookback");
setLowerLimit(1);
setDefault(20);
}
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Avgerage Length");
setLowerLimit(1);
setDefault(20);
}
fpArray[x] = new FunctionParameter("OB", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Overbought Level");
setLowerLimit(0);
setUpperLimit(100);
setDefault(60);
}
fpArray[x] = new FunctionParameter("OS", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Oversold Level");
setLowerLimit(0);
setUpperLimit(100);
setDefault(10);
}
}
var xHS_LS = null;
var xHHS = null;
var xLLS = null;
var bVersion = null;
function main(Lookback, Length, OB, OS){
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if(getBarState() == BARSTATE_ALLBARS){
xHS_LS = efsInternal("calc", Lookback);
xHHS = ema(Length, getSeries(xHS_LS,0));
xLLS = ema(Length, getSeries(xHS_LS,1));
addBand(OB,PS_SOLID,1,Color.lightgrey,"OB");
addBand(OS,PS_SOLID,1,Color.lightgrey,"OS");
}
var nHHS = xHHS.getValue(0);
var nLLS = xLLS.getValue(0);
if(nHHS == null || nLLS == null) return;
return [nHHS, nLLS]
}
var xHigh = null;
var xLow = null;
var xHighestH = null;
var xLowestH = null;
var xHighestL = null;
var xLowestL = null;
var bInit = false;
function calc(Lookback){
if(!bInit){
xHigh = high();
xLow = low();
xHighestH = hhv(Lookback, xHigh);
xLowestH = llv(Lookback, xHigh);
xHighestL = hhv(Lookback, xLow);
xLowestL = llv(Lookback, xLow);
bInit = true;
}
var nHigh = xHigh.getValue(0);
var nHigh_1 = xHigh.getValue(-1);
var nLow = xLow.getValue(0);
var nLow_1 = xLow.getValue(-1);
var nHighestH = xHighestH.getValue(0);
var nLowestH = xLowestH.getValue(0);
var nHighestL = xHighestL.getValue(0);
var nLowestL = xLowestL.getValue(0);
if(nHigh_1 == null || nLow_1 == null || nHighestH == null || nLowestH == null ||
nHighestL == null || nLowestL == null)
return;
var HS = nHigh > nHigh_1? (nHigh-nLowestH)/(nHighestH-nLowestH)*100: 0;
var LS = nLow < nLow_1? (nHighestL-nLow)/(nHighestL-nLowestL)*100: 0;
return [HS,LS]
}
function verify(){
var b = false;
if (getBuildNumber() < 3742){
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;
}