# Code Conversion - AFL to Tradescript

Dayreturn=ROC(C,1);

AC = Param("AC",14,1,20,1);

par1 = Param("Par1",2,1,20,1);

par2 = Param("Par2",3,1,20,1);

AutoCor=Correlation(Dayreturn,Ref(Dayreturn,-1),AC);

crossSell=Cross(StochD(par1,par2,par2),StochK(par1,par2));

CROSSOVER(SOPK(9, 3, 9, SIMPLE),SOPD(9, 3, 9, SIMPLE))

Sell:

CROSSOVER(SOPD(9, 3, 9, SIMPLE),SOPK(9, 3, 9, SIMPLE))

Could also please provide code conversion for the below part…I guess you missed it:
Dayreturn=ROC(C,1);
AC = Param(“AC”,14,1,20,1);
AutoCor=Correlation(Dayreturn,Ref(Dayreturn,-1),AC);

can you expain ROC and AutoCor

ROC - Calculates the periods rate-of-change of ARRAY expressed as percentage. E.g. formula roc( CLOSE, 14 ) returns the 14-period percent rate-of-change of the closing prices.
Correlation - Calculates correlation between ARRAY1 and ARRAY2 using periods range for formula : correlation( ARRAY1, ARRAY2, periods )
e.g. Correlation( Close, Ref( Close, -5 ), 5 ) :- Correlation between Close price AND Close price 5 days back over a period of 5 days.
Hope this clarifies.