DailyPDB.efs, IntradayPDB.efs
EFSLibrary - Discussion Board
File Name:
- DailyPDB.efs
- IntradayPDB.efs
Description:
DailyPDB.efs
PDB indicator for daily charts
IntradayPDB.efs
PDB indicator for intraday charts
Formula Parameters:
DailyPDB.efs
- Starting year : 2010
- Startng month : 1
- Starting day of month : 4
- Percentage upper : 1
- Percentage lower : 1
IntradayPDB.efs
- Startng month : 1
- Starting day of month : 1
- Startng Hour : 1
- Startng Minute : 0
- Percentage upper : 1
- Percentage lower : 1
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
DailyPDB.efs
IntradayPDB.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2010. 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: PDB indicator for daily charts Version: 1.00 05/07/2010 Formula Parameters: Default: Starting year 2010 Startng month 1 Starting day of month 4 Percentage upper 1 Percentage lower 1 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(); var bInit = false; var bVersion = null; function preMain() { setPriceStudy(true); setShowCursorLabel(true); setShowTitleParameters(false); setStudyTitle("PDB indicator"); setCursorLabelName("MIDAS", 0); setDefaultBarFgColor(Color.red, 0); setPlotType(PLOTTYPE_LINE, 0); setDefaultBarThickness(2, 0); setCursorLabelName("Upper", 1); setDefaultBarFgColor(Color.blue, 1); setPlotType(PLOTTYPE_LINE, 1); setDefaultBarThickness(2, 1); setCursorLabelName("Lower", 2); setDefaultBarFgColor(Color.blue, 2); setPlotType(PLOTTYPE_LINE, 2); setDefaultBarThickness(2, 2); askForInput(); var x=0; fpArray[x] = new FunctionParameter("pYear", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Starting year"); setLowerLimit(1900); setUpperLimit(2100); setDefault(2010); } fpArray[x] = new FunctionParameter("pMonth", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Startng month"); setLowerLimit(1); setUpperLimit(12); setDefault(1); } fpArray[x] = new FunctionParameter("pDay", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Starting day of month"); setLowerLimit(1); setUpperLimit(31); setDefault(4); } fpArray[x] = new FunctionParameter("Band1", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Percentage upper"); setLowerLimit(1); setUpperLimit(50); setDefault(1); } fpArray[x] = new FunctionParameter("Band2", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Percentage lower"); setLowerLimit(1); setUpperLimit(50); setDefault(1); } } var xFractalDimension = null; var bStart = false; var xMIDAS = null; function main(pYear, pMonth, pDay, Band1, Band2) { var nBarState = getBarState(); var nHour = getHour(); var nMinute = getMinute(); var nDay = getDay(); var nMonth = getMonth(); var nYear = getYear(); var nMIDAS = 0; var Q1 = 0; var Q2 = 0; if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (!isDaily()) { drawTextAbsolute(5, 35, "This study requires Daily Chart.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "M"); return; } if (nBarState == BARSTATE_ALLBARS) { if (pYear == null) pYear = 2010; if (pMonth == null) pMonth = 1; if (pDay == null) pDay = 4; if (Band1 == null) Band1 = 1; if (Band2 == null) Band2 = 1; } if (nYear == pYear && nMonth == pMonth && nDay == pDay) { bStart = true; } if (bStart) { if (!bInit) { xMIDAS = efsInternal("Calc_MIDAS", pYear, pMonth, pDay); bInit = true; } nMIDAS = xMIDAS.getValue(0); if (nMIDAS == null) return; Q1 = nMIDAS * (1 + Band1 / 100); Q2 = nMIDAS * (1 - Band2 / 100); return new Array(nMIDAS, Q1, Q2); } else { drawTextAbsolute(5, 35, "Start date not found on chart. Edit Start date in Edit Studies.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "M"); return; } } var bCalc_MIDASInit = false; var xMP = null; var xCumMP = null; var xCumVolume = null; var xVolume = null; var nStartV = 0; var nStartMP = 0; function Calc_MIDAS(pYear, pMonth, pDay) { var nMIDAS = 0; var nMP = 0; var nCumMP = 0; var nCumVolume = 0; if (!bCalc_MIDASInit) { xMP = efsInternal("Calc_MP_CumMP_CumV", pYear, pMonth, pDay); xCumMP = getSeries(xMP, 1); xCumVolume = getSeries(xMP, 2); xVolume = volume(); bCalc_MIDASInit = true; } nMP = xMP.getValue(0); nCumMP = xCumMP.getValue(0); nCumVolume = xCumVolume.getValue(0); if (nMP == null || nCumMP == null || nCumVolume == null) return; if (nStartV == 0 || nStartMP == 0) { nStartV = xVolume.getValue(0); nStartMP = xCumMP.getValue(0); } nMIDAS = (nCumMP - nStartMP) / (nCumVolume - nStartV) return nMIDAS; } var bCalc_MPInit = false; var xHL2 = null; var xVolume = null; var nCumMP = 0; var nCumV = 0; var bStartCalc = false; function Calc_MP_CumMP_CumV(pYear, pMonth, pDay) { var nRes = 0; var nlocCumMP = 0; var nlocCumV = 0; var nVolume = 0; var nHour = getHour(); var nMinute = getMinute(); var nDay = getDay(); var nMonth = getMonth(); var nYear = getYear(); if (!bCalc_MPInit) { xHL2 = hl2(); xVolume = volume(); bCalc_MPInit = true; } if (nYear == pYear && nMonth == pMonth && nDay == pDay) { bStartCalc = true; } if (bStartCalc) { nVolume = xVolume.getValue(0); nRes = xHL2.getValue(0) * nVolume; if (getBarState() == BARSTATE_NEWBAR) { nCumMP = nCumMP + nRes; nCumV = nCumV + nVolume; nlocCumMP = nCumMP; nlocCumV = nCumV; } else { nlocCumMP = nCumMP + nRes; nlocCumV = nCumV + nVolume; } return new Array(nRes, nlocCumMP, nlocCumV); } else { return new Array(null, null, null); } } 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; }
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2010. 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: PDB indicator for intraday charts Version: 1.00 05/07/2010 Formula Parameters: Default: Startng month 1 Starting day of month 1 Startng Hour 1 Startng Minute 0 Percentage upper 1 Percentage lower 1 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(); var bInit = false; var bVersion = null; function preMain() { setPriceStudy(true); setShowCursorLabel(true); setShowTitleParameters(false); setStudyTitle("PDB indicator"); setCursorLabelName("MIDAS", 0); setDefaultBarFgColor(Color.red, 0); setPlotType(PLOTTYPE_LINE, 0); setDefaultBarThickness(2, 0); setCursorLabelName("Upper", 1); setDefaultBarFgColor(Color.blue, 1); setPlotType(PLOTTYPE_LINE, 1); setDefaultBarThickness(2, 1); setCursorLabelName("Lower", 2); setDefaultBarFgColor(Color.blue, 2); setPlotType(PLOTTYPE_LINE, 2); setDefaultBarThickness(2, 2); askForInput(); var x=0; fpArray[x] = new FunctionParameter("pMonth", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Startng month"); setLowerLimit(1); setUpperLimit(12); setDefault(1); } fpArray[x] = new FunctionParameter("pDay", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Starting day of month"); setLowerLimit(1); setUpperLimit(31); setDefault(1); } fpArray[x] = new FunctionParameter("pHour", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Starting hour"); setLowerLimit(0); setUpperLimit(23); setDefault(1); } fpArray[x] = new FunctionParameter("pMinute", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Starting minute"); setLowerLimit(0); setUpperLimit(59); setDefault(0); } fpArray[x] = new FunctionParameter("Band1", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Percentage upper"); setLowerLimit(1); setUpperLimit(50); setDefault(1); } fpArray[x] = new FunctionParameter("Band2", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Percentage lower"); setLowerLimit(1); setUpperLimit(50); setDefault(1); } } var xFractalDimension = null; var bStart = false; var xMIDAS = null; function main(pMonth, pDay, pHour, pMinute, Band1, Band2) { var nBarState = getBarState(); var nHour = getHour(); var nMinute = getMinute(); var nDay = getDay(); var nMonth = getMonth(); var nMIDAS = 0; var Q1 = 0; var Q2 = 0; if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (isDaily() || isMonthly() || isWeekly()) { drawTextAbsolute(5, 35, "This study requires Intraday Chart.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "M"); return; } if (nBarState == BARSTATE_ALLBARS) { if (pMonth == null) pMonth = 1; if (pDay == null) pDay = 1; if (pHour == null) pHour = 1; if (pMinute == null) pMinute = 0; if (Band1 == null) Band1 = 1; if (Band2 == null) Band2 = 1; } if (nMonth == pMonth && nDay == pDay && nHour == pHour && nMinute == pMinute) { bStart = true; } if (bStart) { if (!bInit) { xMIDAS = efsInternal("Calc_MIDAS", pMonth, pDay, pHour, pMinute); bInit = true; } nMIDAS = xMIDAS.getValue(0); if (nMIDAS == null) return; Q1 = nMIDAS * (1 + Band1 / 100); Q2 = nMIDAS * (1 - Band2 / 100); return new Array(nMIDAS, Q1, Q2); } else { drawTextAbsolute(5, 35, "Start date/time not found on chart. Edit Start date/time in Edit Studies.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "M"); return; } } var bCalc_MIDASInit = false; var xMP = null; var xCumMP = null; var xCumVolume = null; var xVolume = null; var nStartV = 0; var nStartMP = 0; function Calc_MIDAS(pMonth, pDay, pHour, pMinute) { var nMIDAS = 0; var nMP = 0; var nCumMP = 0; var nCumVolume = 0; if (!bCalc_MIDASInit) { xMP = efsInternal("Calc_MP_CumMP_CumV", pMonth, pDay, pHour, pMinute); xCumMP = getSeries(xMP, 1); xCumVolume = getSeries(xMP, 2); xVolume = volume(); bCalc_MIDASInit = true; } nMP = xMP.getValue(0); nCumMP = xCumMP.getValue(0); nCumVolume = xCumVolume.getValue(0); if (nMP == null || nCumMP == null || nCumVolume == null) return; if (nStartV == 0 || nStartMP == 0) { nStartV = xVolume.getValue(0); nStartMP = xCumMP.getValue(0); } nMIDAS = (nCumMP - nStartMP) / (nCumVolume - nStartV) return nMIDAS; } var bCalc_MPInit = false; var xHL2 = null; var xVolume = null; var nCumMP = 0; var nCumV = 0; var bStartCalc = false; function Calc_MP_CumMP_CumV(pMonth, pDay, pHour, pMinute) { var nRes = 0; var nlocCumMP = 0; var nlocCumV = 0; var nVolume = 0; var nHour = getHour(); var nMinute = getMinute(); var nDay = getDay(); var nMonth = getMonth(); if (!bCalc_MPInit) { xHL2 = hl2(); xVolume = volume(); bCalc_MPInit = true; } if (nMonth == pMonth && nDay == pDay && nHour == pHour && nMinute == pMinute) { bStartCalc = true; } if (bStartCalc) { nVolume = xVolume.getValue(0); nRes = xHL2.getValue(0) * nVolume; if (getBarState() == BARSTATE_NEWBAR) { nCumMP = nCumMP + nRes; nCumV = nCumV + nVolume; nlocCumMP = nCumMP; nlocCumV = nCumV; } else { nlocCumMP = nCumMP + nRes; nlocCumV = nCumV + nVolume; } return new Array(nRes, nlocCumMP, nlocCumV); } else { return new Array(null, null, null); } } 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; }