ATRS() from indicators.c

Posted By: webradio

ATRS() from indicators.c - 09/21/14 08:55

from indicators.c
Code:
// Simple ATR based on SMA
var ATRS(int Period)
{
	Period = max(1,Period);
	var vATRS =  0;
	for(g_count = 0; g_count < Period; g_count++)
		vATRS = priceHigh(g_count)-priceLow(g_count);
	return vATRS/Period;
}


I'm wondering if it should be rather
Code:
vATRS += priceHigh...


what am I missing?
Posted By: 3DCat

Re: ATRS() from indicators.c - 09/21/14 11:52

Originally Posted By: webradio

what am I missing?


That:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=445505#Post445505
Posted By: Mithrandir77

Re: ATRS() from indicators.c - 09/21/14 20:14

Yes, as noted by jcl in that thread, it will be corrected in the next version, meanwhile you can correct yourself the code. This is the correct one:

Code:
// Simple ATR based on SMA
var ATRS(int Period)
{
	Period = max(1,Period);
	var vATRS =  0;
	for(g_count = 0; g_count < Period; g_count++)
		vATRS += priceHigh(g_count)-priceLow(g_count);
	return vATRS/Period;
}

© 2024 lite-C Forums