File Name: DirectionCongestion.efs
Description:
This formula is based on an RSI study and identifies general direction and areas of congestion.
Formula Parameters:
Price Source: Default is “Close”
RSILength: Default is 21.
LEN: Default is 9. This is a constant used by the formula calculation.
Upper_Dot_Color: Default is Cyan.
Lower_Dot_Color: Default is Maroon.
Notes:
Bars that have dots both above and below the bars represent the areas of congestion. If the dots are only above the bars, the general direction is negative and positive when the dots are only below the bars.
Download File:
DirectionCongestion.efs
EFS Code:
Description:
This formula is based on an RSI study and identifies general direction and areas of congestion.
Formula Parameters:
Price Source: Default is “Close”
RSILength: Default is 21.
LEN: Default is 9. This is a constant used by the formula calculation.
Upper_Dot_Color: Default is Cyan.
Lower_Dot_Color: Default is Maroon.
Notes:
Bars that have dots both above and below the bars represent the areas of congestion. If the dots are only above the bars, the general direction is negative and positive when the dots are only below the bars.
Download File:
DirectionCongestion.efs
EFS Code:
PHP Code:
/*********************************
Provided By : eSignal. (c) Copyright 2003
*********************************/
function preMain() {
setPriceStudy(true);
setStudyTitle("Direction/Congestion ");
setShowCursorLabel(false);
setComputeOnClose(true);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setPlotType(PLOTTYPE_DOT, 0);
setPlotType(PLOTTYPE_DOT, 1);
setDefaultBarThickness(1, 0);
setDefaultBarThickness(1, 1);
setDefaultBarFgColor(Color.maroon, 0);
setDefaultBarFgColor(Color.maroon, 1);
var fp1 = new FunctionParameter("Price_Source", FunctionParameter.STRING);
fp1.setName("Price Source");
fp1.addOption("Open");
fp1.addOption("High");
fp1.addOption("Low");
fp1.addOption("Close");
fp1.addOption("HL/2");
fp1.addOption("HLC/3");
fp1.addOption("OHLC/4");
fp1.setDefault("Close");
var fp2 = new FunctionParameter("RSILength", FunctionParameter.NUMBER);
fp2.setName("RSILength");
fp2.setLowerLimit(1);
fp2.setUpperLimit(1000);
fp2.setDefault(21);
var fp3 = new FunctionParameter("LEN", FunctionParameter.NUMBER);
fp3.setName("LEN");
fp3.setLowerLimit(1);
fp3.setUpperLimit(1000);
fp3.setDefault(9);
var fp4 = new FunctionParameter("Upper_Dot_Color", FunctionParameter.COLOR);
fp4.setName("Upper_Dot_Color");
fp4.setDefault(Color.cyan);
var fp5 = new FunctionParameter("Lower_Dot_Color", FunctionParameter.COLOR);
fp5.setName("Lower_Dot_Color");
fp5.setDefault(Color.maroon);
}
var study = null;
var Center = 0;
var Upper = 0;
var Lower = 0;
var Avernge = 0;
var BarCntr = 0;
var Value3 = null; // Sell line
var Value4 = null; // Buy Line
function main(Price_Source, RSILength, LEN, Upper_Dot_Color, Lower_Dot_Color) {
RSILength = Math.abs(Math.round(RSILength));
LEN = Math.abs(Math.round(LEN));
if (study == null) study = new RSIStudy(RSILength, Price_Source);
var vRSI = study.getValue(RSIStudy.RSI);
if (vRSI == null) return;
var Constnt = 4;
if (getBarState() == BARSTATE_NEWBAR) {
BarCntr += 1;
}
Value3 = (Center + Upper)/2; // Sell line
Value4 = (Center + Lower)/2; // Buy Line
Center = (Center * (LEN-1) + close()) / LEN;
Avernge = (Avernge * (LEN-1) + high() - low()) / LEN;
Upper = Center + Avernge * Constnt;
Lower = Center - Avernge * Constnt;
setBarFgColor(Upper_Dot_Color, 0);
setBarFgColor(Lower_Dot_Color, 1);
if (BarCntr > 20) {
if (vRSI > 52) Value3 = null;
if (vRSI < 48) Value4 = null;
return new Array(Value3, Value4);
} else {
return;
}
}