[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Dinapoli Stochastic - eSignal version



PureBytes Links

Trading Reference Links

Here is the eSignal version of Dinapoli stochastic. Can someone 
convert this to Amibroker

function main(nLength, nSmoothing, nSmoothings) {
    if(nLength == null)
        nLength = 8;
    if(nSmoothing == null)
        nSmoothing = 3;
    if(nSmoothings == null)
        nSmoothings = 3;

    var percentK;
    var ll = 0, hh = 0;
    var i,j;
    var sum = 0;
    var vHigh = getValue("High", 0, -nLength);
    var vLow = getValue("Low", 0, -nLength);
    var temp = 0;
    var MAVt;
    var MAVt1;
    
	if(vHigh == null || vLow == null)
		return;


	for(j = 0; j < nLength; j++)
		if(j == 0){
			ll = vLow[j];	
			hh = vHigh[j];
		}
		else{
			hh = Math.max(hh, vHigh[j]);
			ll = Math.min(ll, vLow[j]);
        	}
       
	percentK = ((close() - ll) / (hh - ll)) * 100;
	MAVt = MAVt_1 + (percentK - MAVt_1) / nSmoothing;
	if (getBarState() == BARSTATE_NEWBAR)
		MAVt_1 = MAVt;
	MAVt1 = MAVt1_1 + (MAVt - MAVt1_1) / nSmoothings;
	if (getBarState() == BARSTATE_NEWBAR)
		MAVt1_1 = MAVt1;
	return new Array(MAVt,MAVt1);
}


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/