ABillW_Alligator.efs
EFSLibrary - Discussion Board
File Name: ABillW_Alligator.efs
Description:
Bill Williams Alligator Averages
Formula Parameters:
- Length Slow: 21
- Length Medium: 13
- Length Fast: 8
- Offset Slow: 8
- Offset Medium: 5
- Offset Fast: 3
Notes:
This indicator calculates 3 Moving Averages for 21, 13 and 8 days, with displacement 8, 5 and 3 days: Median Price (High+Low/2).
Download File:
ABillW_Alligator.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2008. 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: Bill Williams Alligator Averages Version: 1.0 09/24/2008 Notes: This indicator calculates 3 Moving Averages for 21, 13 and 8 days, with displacement 8, 5 and 3 days: Median Price (High+Low/2). Formula Parameters: Default: Length Slow 21 Length Medium 13 Length Fast 8 Offset Slow 8 Offset Medium 5 Offset Fast 3 **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setPriceStudy(true); setStudyTitle("Alligator"); setCursorLabelName("Plot1", 0); setCursorLabelName("Plot2", 1); setCursorLabelName("Plot3", 2); setDefaultBarFgColor(Color.blue, 0); setDefaultBarFgColor(Color.red, 1); setDefaultBarFgColor(Color.green, 2); setDefaultBarFgColor(Color.black, 3); var x=0; fpArray[x] = new FunctionParameter("LengthSlow", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Length Slow"); setLowerLimit(1); setDefault(21); } fpArray[x] = new FunctionParameter("OffsetSlow", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Offset Slow"); setLowerLimit(1); setDefault(8); } fpArray[x] = new FunctionParameter("LengthMedium", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Length Medium"); setLowerLimit(1); setDefault(13); } fpArray[x] = new FunctionParameter("OffsetMedium", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Offset Medium"); setLowerLimit(1); setDefault(5); } fpArray[x] = new FunctionParameter("LengthFast", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Length Fast"); setLowerLimit(1); setDefault(8); } fpArray[x] = new FunctionParameter("OffsetFast", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Offset Fast"); setLowerLimit(1); setDefault(3); } } var xhl2 = null; var xEMA1 = null; var xEMA2 = null; var xEMA3 = null; function main(LengthSlow, OffsetSlow, LengthMedium, OffsetMedium, LengthFast, OffsetFast) { var nXA1 = 0; var nXA2 = 0; var nXA3 = 0; if (LengthSlow == null) LengthSlow = 21; if (OffsetSlow == null) OffsetSlow = 8; if (LengthMedium == null) LengthMedium = 13; if (OffsetMedium == null) OffsetMedium = 5; if (LengthFast == null) LengthFast = 8; if (OffsetFast == null) OffsetFast = 3; if ( bInit == false ) { xhl2 = hl2(); xEMA1 = offsetSeries(ema(LengthSlow, xhl2), OffsetSlow); xEMA2 = offsetSeries(ema(LengthMedium, xhl2), OffsetMedium); xEMA3 = offsetSeries(ema(LengthFast, xhl2), OffsetFast); bInit = true; } nXA1 = xEMA1.getValue(0); nXA2 = xEMA2.getValue(0); nXA3 = xEMA3.getValue(0); return new Array(nXA1, nXA2, nXA3); }