SSL_Channel.efs
EFSLibrary - Discussion Board
File Name: SSL_Channel.efs
Description:
SSL Channel
Formula Parameters:
- Length : 10
- Line Color 1 : Red
- Line Color 2 : Green
Notes:
Download File:
SSL_Channel.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2009. All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only and may be modified and saved under a new file name. eSignal is not responsible for the functionality once modified. eSignal reserves the right to modify and overwrite this EFS file with each new release. Description: SSL Channel Version: 1.0 06/22/2009 Formula Parameters: Default: Length 10 Line Color 1 Red Line Color 2 Green Notes: **********************************/ var fpArray = new Array(); var bInit = false; function preMain(){ setPriceStudy(true); setShowCursorLabel(true); setShowTitleParameters(false); setStudyTitle("SSL Channel"); setCursorLabelName("Line 1", 0); setDefaultBarFgColor(Color.red, 0); setPlotType(PLOTTYPE_LINE, 0); setDefaultBarThickness(2, 0); setCursorLabelName("Line 2", 1); setDefaultBarFgColor(Color.green, 1); setPlotType(PLOTTYPE_LINE, 1); setDefaultBarThickness(2, 1); var x = 0; fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(10); } fpArray[x] = new FunctionParameter("MALine1", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Line Color 1"); setDefault(Color.red); } fpArray[x] = new FunctionParameter("MALine2", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Line Color 2"); setDefault(Color.green); } } var xMAHigh = null; var xMALow = null; var nFlag = 1; function main(Length, MALine1, MALine2) { var nBarState = getBarState(); var nMAHigh = 0; var nMALow = 0; var nClose = 0; var nRes1 = 0; var nRes2 = 0; if (nBarState == BARSTATE_ALLBARS) { if(Length == null) Length = 10; if(MALine1 == null) MALine1 = Color.red; if(MALine2 == null) MALine2 = Color.green; } if (bInit == false) { setDefaultBarFgColor(MALine1, 0); setDefaultBarFgColor(MALine2, 1); xMAHigh = sma(Length, high()); xMALow = sma(Length, low()); bInit = true; } nMAHigh = xMAHigh.getValue(-1); nMALow = xMALow.getValue(-1); nClose = close(0); if (nMAHigh == null) return; if (nClose > nMAHigh) nFlag = 1; if (nClose < nMALow) nFlag = -1; if (nFlag == 1) { nRes1 = nMAHigh; nRes2 = nMALow; } if (nFlag == -1) { nRes1 = nMALow; nRes2 = nMAHigh; } return new Array(nRes2, nRes1); }