More Information about: Link: 1) www.incrediblecharts.com/indicators/detrended_price_oscillator.php Link: 2) www.stator-afm.com/detrended-price-oscillator.html Link: 3) www.paritech.com.au/education/technical/custom/indicators/detrended.asp |
Source Code "The Detrended Price Oscillator ": |
||
function init() { with (DPO) { createBuffer("DPO"); setBufferColor("DPO", "lime"); setBufferDrawStyle("DPO", DrawStyle.LINE); setAutoChangeMaxMin("DPO"); addLevel(0, "white"); createParameter("Period", 20); } } function start() { var period = DPO.parameter("Period"); DPO.label = "DPO (" + period + ")"; var num = Shared.numberOfQuotes(); var DPObuf = new Array(num); var CloseBuf = Shared.close(); var SmaBuf = Shared.sma( period, Shared.close()); for (var i = period/2 + 1; i < num; ++i) { DPObuf[i] = CloseBuf[i] - SmaBuf[i - period/2 -1]; } DPO.setBufferData("DPO", DPObuf); } |