I've worked a little bit on converting John Ehler's Easy Language code for his adaptive RSI into zorro code. I'm a beginner to coding in general and have only gone through a beginner's python course. Hoping that somebody can help me put this together.

Below is John Ehler's Easy Language code for the adaptive RSI:

Quote:

//Declares all variables...

//Highpass filter cyclic components whos periods are shorter than 48 bars
Alpha1 = (Cosine(.707*360/48) + Sine (.707*360 / 48) – 1) / Cosine (.707*360 / 48);
HP = (1-alpha1 / 2) * (1 – alpha1 / 2) * (Close – 2*Close[1]) + Close[2]) + 2*(1-alpha1*HP[1] – (1-alpha1)*(1-alpha1)*HP[2]
//Smooth with a super smoother filter
a1 = exp(-1.414*3.14159 / 10);
b1 = 2*a1*cos(1.414*180 / 10);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;
Filt = c1*(HP + HP[1]) / 2 + c2*Filt[1] + c3 * Filt[2];

//John Ehlers then proceeds to calculate the dominant cycle with his method (not shown)

//Adaptive RSI
ClosesUp(0);
ClosesDn(0);
Denom(0);
MyRSI(0);
ClosesUp = 0;
ClosesDn = 0;

For Count = 0 to IntPortion(DominantCycle / 2 – 1) Begin
If (Filt[count] > Filt[count + 1])
Then ClosesUp = ClosesUp + (Filt[count] - Filt[count + 1]);

If (Filt[count] < Filt[count + 1])
Then ClosesDn = ClosesDn + (Filt[count + 1] - Filt[count]);

if (Denom[0] <> 0 && Denom[1] <> 0) Then
MyRSI = c1 * (ClosesUp[0] / Denom[0] + ClosesUp[1] / Denom[1]) / 2 + c2 * MyRSI[1] + c3 * MyRSI[2];

Plot1(MyRSI);


Below is my failed attempt at converting the script to zorro's language:

Quote:
//John Ehlers Adaptive RSI from "Cycle Analytics For Traders"

function run(){
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;

vars Price = series(price());
vars PriceSmooth = series(Smooth(Price, 10));

//Highpass Filter
vars HP = series(HighPass1(Price, 48));

//Smooth with SuperSmoother
vars Filt = series(Smooth(HP,10));

//Dominant Period
var Dominant = DominantPeriod(Price, 10);

//Adaptive RSI
var ClosesUp = 0;
var ClosesDn = 0;
int count = 0;

for(count = 0; count < (Dominant / 2); count++) {

if (Filt[count] > Filt[count + 1])
return ClosesUp = ClosesUp + (Filt[count] - Filt[count + 1]);

else if (Filt[count] < Filt[count + 1])
return ClosesDn = ClosesDn + (Filt[count + 1] - Filt[count]);
}

vars MyRSI;
vars Denom = ClosesUp + ClosesDn;

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


plot("MyRSI", Dominant, NEW, RED);
}


What I'm mainly not sure about is how to convert the easy language code to zorro that has the same variable one is defining in its equation. f.i. MyRSI = c1 * MyRSI[1] + MyRSI[2]. So I'm really not sure if my "Filt" variable is right and just really now sure how to define the "MyRSI" varaible in zorro. Honestly not sure if any of this is right. Any help would be super appreciated.