Posted By: danatrader
Price clusters - 07/17/20 19:14
On TFH it states detecting price clusters is easy.
How would an easy approach work in Lite-C?
How would an easy approach work in Lite-C?
void run() { int arrayHiLoLen = 1000; LookBack = 1000; var PIP10 = PIP * 10; var high = ceil(priceHigh(0) / PIP10) * PIP10; var low = ceil(priceLow(0) / PIP10) * PIP10; vars highs = series(high); vars lows = series(low); // if(!is(LOOKBACK)) { var highest = MaxVal(highs, arrayHiLoLen); var lowest = MinVal(lows, arrayHiLoLen); int arrLen = ((highest - lowest) / PIP10) + 1; int *binCount = zalloc(arrLen * sizeof(int)); // int i; for (i = 0; i < arrayHiLoLen; i++) { int enIdx = (highs[i] - lowest) / PIP10; int stIdx = (lows[i] - lowest) / PIP10; int j; for (j = stIdx; j <= enIdx; j++) { binCount[j]++; } } if(is(EXITRUN)) { printf("\n"); int i; for (i = 0; i < arrLen; i++) { printf("%i ", binCount[i]); } printf("\n %f %f %i %f \n\n", lowest, highest, arrLen, PIP10); } } }