Calculate the mean deviation by subtracting the MA from the typical price for the last 20 periods.Sum the absolute values (ignore minus signs) of these figures and then divide by 20 . Insert the most recent typical price, the MA, and the mean deviation into the formula to compute the current CCI reading.
Unfortunately I do not understand what you are looking for.
The CCI aka. Commodity Channel Index is readily available in AmiBroker; please, see the documentation: AFL Function Reference - CCI
Why do you want to calculate it yourself?
Is it certainly possible to replicate it in your formula, following the steps indicated (a good example is here) but I do not see the point of doing it.