Hello,

This code show slow RSI. I mean rsi[0] corresponding with price[3] or [4], [5]. So, how to make it match with price ?

Code:
//Adaptive Rsi

var ARSI(var* Price)

{

	var a1 = exp(-1.414*3.14159 / 10);

	var b1 = 2*a1*cos(1.414*180 / 10);

	var c2 = b1;

	var c3 = -a1*a1;

	var c1 = 1 - c2 - c3;







	//Highpass Filter

	vars HP = series(HighPass1(Price, 48));



	//Smooth with SuperSmoother

	vars Filt = series(Smooth(HP,10));



	//Dominant Period

	vars Dominant = series(DominantPeriod(Price, 50));



	// Hurst

	//vars hurst = series(Hurst(Price, 70));



	//Adaptive RSI

	vars ClosesUp = series(0);

	vars ClosesDn = series(0);

	vars MyRSI = series(0);

	vars Denom = series(0);

	int count = 0;



	for(count = 0; count < (Dominant[0] / 2 - 1); count++) 

	{



		if (Filt[count] > Filt[count + 1])

		ClosesUp[0] = ClosesUp[0] + (Filt[count] - Filt[count + 1]);



		if (Filt[count] < Filt[count + 1])

		ClosesDn[0] = ClosesDn[0] + (Filt[count + 1] - Filt[count]);

	}



	Denom[0] = ClosesUp[0] + ClosesDn[0];



	if (Denom[0] != 0 && Denom[1] != 0)

	MyRSI[0] = c1 * (ClosesUp[0] / Denom[0] + ClosesUp[1] / Denom[1]) / 2 + c2 * MyRSI[1] + c3 * MyRSI[2];

	return MyRSI[0];

}