File Name: SVEZLRBPercB.efs
Description:
Oscillators, Smoothed by Sylvain Vervoort
Formula Parameters:
SVEZLRBPercB.efs
PercentB Deviation Period: 18
PercentB Average: 3
Stochastic Period: 30
Stochastic Slowing: 3
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
SVEZLRBPercB.efs
SVEZLRBPercB.efs
EFS Code:
Description:
Oscillators, Smoothed by Sylvain Vervoort
Formula Parameters:
SVEZLRBPercB.efs
PercentB Deviation Period: 18
PercentB Average: 3
Stochastic Period: 30
Stochastic Slowing: 3
Notes:
The related article is copyrighted material. If you are not a subscriber
of Stocks & Commodities, please visit www.traders.com.
Download File:
SVEZLRBPercB.efs
SVEZLRBPercB.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
Interactive Data Corporation (Copyright © 2013)
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:
Oscillators, Smoothed by Sylvain Vervoort
Version: 1.00 04/06/2013
Formula Parameters: Default:
PercentB Deviation Period 18
PercentB Average 3
Stochastic Period 30
Stochastic Slowing 3
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()
{
setStudyTitle("SVEZLRBPercB");
setCursorLabelName("Overbought", 0);
setCursorLabelName("Neutral", 1);
setCursorLabelName("Oversold", 2);
setCursorLabelName("PB_Plot", 3);
setCursorLabelName("K", 4);
setDefaultBarFgColor(Color.grey, 0);
setDefaultBarFgColor(Color.grey, 1);
setDefaultBarFgColor(Color.grey, 2);
setDefaultBarFgColor(Color.blue, 3);
setDefaultBarFgColor(Color.red, 4);
setPlotType(PLOTTYPE_DOT, 0);
setPlotType(PLOTTYPE_DOT, 1);
setPlotType(PLOTTYPE_DOT, 2);
setPlotType(PLOTTYPE_LINE, 3);
setPlotType(PLOTTYPE_LINE, 4);
setDefaultBarThickness(1, 0);
setDefaultBarThickness(2, 1);
setDefaultBarThickness(1, 2);
setDefaultBarThickness(1, 3);
setDefaultBarThickness(1, 4);
setShowCursorLabel(false, 0);
setShowCursorLabel(false, 1);
setShowCursorLabel(false, 2);
setShowCursorLabel(true, 3);
setShowCursorLabel(true, 4);
var x = 0;
fpArray[x] = new FunctionParameter("fpStDevPeriod", FunctionParameter.NUMBER);
with(fpArray[x++])
{
setName("PercentB Deviation Period");
setLowerLimit(1);
setDefault(18);
}
fpArray[x] = new FunctionParameter("fpSmooth", FunctionParameter.NUMBER);
with(fpArray[x++])
{
setName( "PercentB Average" );
setLowerLimit(1);
setDefault(3);
}
fpArray[x] = new FunctionParameter("fpPeriodK", FunctionParameter.NUMBER);
with(fpArray[x++])
{
setName( "Stochastic Period" );
setLowerLimit(1);
setDefault(30);
}
fpArray[x] = new FunctionParameter("fpSmoothK", FunctionParameter.NUMBER);
with(fpArray[x++])
{
setName( "Stochastic Slowing" );
setLowerLimit(1);
setDefault(3);
}
}
var bInit = false;
var bVersion = null;
var xRainbow = null;
var xEMA1 = null;
var xEMA2 = null;
var xZLRB = null;
var xTEMA = null;
var xStdDev = null;
var xWMA = null;
var xRBC = null;
var xNom = null;
var xDen = null;
var xFastK = null;
var xSMA = null;
function main(fpStDevPeriod, fpSmooth, fpPeriodK, fpSmoothK)
{
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (!bInit)
{
xRainbow = efsInternal("Calc_Rainbow");
xEMA1 = ema(fpSmooth, xRainbow);
xEMA2 = ema(fpSmooth, xEMA1);
xZLRB = efsInternal("Calc_ZLRB", xEMA1, xEMA2);
xTEMA = efsInternal("Calc_TEMA", fpSmooth, xZLRB);
xStdDev = efsInternal("Calc_StdDev", fpStDevPeriod, xTEMA);
xWMA = wma(fpStDevPeriod, xTEMA);
xRBC = efsInternal("Calc_RBC", xRainbow);
xNom = efsInternal("Calc_Nom", fpPeriodK, xRBC);
xDen = efsInternal("Calc_Den", fpPeriodK, xRBC);
xFastK = efsInternal("Calc_FastK", xNom, xDen);
xSMA = sma(fpSmoothK, xFastK);
bInit = true;
}
var nTEMA = 0;
var nStdDev = 0;
var nWMA = 0;
var nFastK = 0;
var nDen = 0;
var nOverbought = 100;
var nNeutral = 50;
var nOversold = 0;
var nPB_Plot = 0;
var nK = 0;
nTEMA = xTEMA.getValue(0);
nStdDev = xStdDev.getValue(0);
nWMA = xWMA.getValue(0);
if (nTEMA == null || nStdDev == null || nWMA == null)
return;
nPB_Plot = (nTEMA + 2 * nStdDev - nWMA) / (4 * nStdDev) * 100;
nFastK = 50;
nDen = xDen.getValue(0);
if (nDen == null)
return;
if (nDen > 0)
{
nK = xSMA.getValue(0);
}
else
{
nK = nFastK;
}
if (nK == null)
return;
return [nOverbought, nNeutral, nOversold, nPB_Plot, nK];
}
var xMA1 = null;
var xMA2 = null;
var xMA3 = null;
var xMA4 = null;
var xMA5 = null;
var xMA6 = null;
var xMA7 = null;
var xMA8 = null;
var xMA9 = null;
var xMA10 = null;
function Calc_Rainbow()
{
var nSmaPeriod = 2;
if (getBarState() == BARSTATE_ALLBARS)
{
xMA1 = sma(nSmaPeriod);
xMA2 = sma(nSmaPeriod, xMA1);
xMA3 = sma(nSmaPeriod, xMA2);
xMA4 = sma(nSmaPeriod, xMA3);
xMA5 = sma(nSmaPeriod, xMA4);
xMA6 = sma(nSmaPeriod, xMA5);
xMA7 = sma(nSmaPeriod, xMA6);
xMA8 = sma(nSmaPeriod, xMA7);
xMA9 = sma(nSmaPeriod, xMA8);
xMA10 = sma(nSmaPeriod, xMA9);
}
var aAvg = new Array();
var nSum = 0;
var nReturnValue = 0;
aAvg[0] = 5*xMA1.getValue(0);
aAvg[1] = 4*xMA2.getValue(0);
aAvg[2] = 3*xMA3.getValue(0);
aAvg[3] = 2*xMA4.getValue(0);
aAvg[4] = xMA5.getValue(0);
aAvg[5] = xMA6.getValue(0);
aAvg[6] = xMA7.getValue(0);
aAvg[7] = xMA8.getValue(0);
aAvg[8] = xMA9.getValue(0);
aAvg[9] = xMA10.getValue(0);
for (var i = 0; i < aAvg.length; i++)
{
if (aAvg[i] == null)
return;
nSum += aAvg[i];
}
nReturnValue = nSum/20;
return nReturnValue;
}
function Calc_ZLRB(xSeries1, xSeries2)
{
var nDiff = 0;
var nSeries1 = 0;
var nSeries2 = 0;
var nReturnValue = 0;
nSeries1 = xSeries1.getValue(0);
nSeries2 = xSeries2.getValue(0);
if (nSeries1 == null || nSeries2 == null)
return;
nDiff = nSeries1 - nSeries2;
nReturnValue = nSeries1 + nDiff;
return nReturnValue;
}
var xTEMAEma1 = null;
var xTEMAEma2 = null;
var xTEMAEma3 = null;
function Calc_TEMA(nPeriod, xSeries)
{
if (getBarState() == BARSTATE_ALLBARS)
{
xTEMAEma1 = ema(nPeriod, xSeries);
xTEMAEma2 = ema(nPeriod, xTEMAEma1);
xTEMAEma3 = ema(nPeriod, xTEMAEma2);
}
var nTEMAEma1 = 0;
var nTEMAEma2 = 0;
var nTEMAEma3 = 0;
var nReturnValue = 0;
nTEMAEma1 = xTEMAEma1.getValue(0);
nTEMAEma2 = xTEMAEma2.getValue(0);
nTEMAEma3 = xTEMAEma3.getValue(0);
if (nTEMAEma1 == null || nTEMAEma2 == null || nTEMAEma3 == null)
return null;
nReturnValue = 3 * nTEMAEma1 - 3 * nTEMAEma2 + nTEMAEma3;
return nReturnValue;
}
function Calc_StdDev(nPeriod, xSeries)
{
if (xSeries.getValue(-nPeriod + 1) == null)
return;
var nCurValue = 0;
var nSum1 = 0;
var nSum2 = 0;
var nMean = 0;
var nReturnValue = 0;
for (i = 0; i < nPeriod; i++)
{
nCurValue = xSeries.getValue(-i);
nSum1 += nCurValue;
nSum2 += (nCurValue * nCurValue);
}
nMean = (nSum1 / nPeriod);
nReturnValue = Math.sqrt((nSum2 / nPeriod) - (nMean * nMean));
return nReturnValue;
}
var xHLC3 = null;
function Calc_RBC(xSeries)
{
if (getBarState() == BARSTATE_ALLBARS)
{
xHLC3 = hlc3();
}
var nSeries = 0;
var nHLC3 = 0;
var nReturnValue = 0;
nSeries = xSeries.getValue(0);
nHLC3 = xHLC3.getValue(0);
if (nSeries == null || nHLC3 == null)
return;
nReturnValue = (nSeries + nHLC3)/2
return nReturnValue;
}
var xLow = null;
var xMinNow = null;
function Calc_Nom(nPeriod, xSeries)
{
if (getBarState() == BARSTATE_ALLBARS)
{
xLow = low();
xMinNow = lowest(nPeriod, xLow)
}
var nSeries = 0;
var nMinNow = 0;
var nReturnValue = 0;
nSeries = xSeries.getValue(0);
nMinNow = xMinNow.getValue(0);
if (nSeries == null || nMinNow == null)
return;
nReturnValue = nSeries - nMinNow;
return nReturnValue;
}
var xHigh = null;
var xMinDen = null;
var xMaxDen = null;
function Calc_Den(nPeriod, xSeries)
{
if (getBarState() == BARSTATE_ALLBARS)
{
xHigh = high();
xMaxDen = highest(nPeriod, xHigh);
xMinDen = lowest(nPeriod, xSeries);
}
var nMinDen = 0;
var nMaxDen = 0;
var nReturnValue = 0;
nMinDen = xMinDen.getValue(0);
nMaxDen = xMaxDen.getValue(0);
if (nMinDen == null || nMaxDen == null)
return;
nReturnValue = nMaxDen - nMinDen;
return nReturnValue;
}
function Calc_FastK(xSeries1, xSeries2)
{
var nSeries1 = 0;
var nSeries2 = 0;
var nReturnValue = 0;
nSeries1 = xSeries1.getValue(0);
nSeries2 = xSeries2.getValue(0);
if (nSeries1 == null || nSeries2 == null)
return;
nReturnValue = Math.min(100, Math.max(0, 100 * nSeries1 / nSeries2));
return nReturnValue;
}
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.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;
}