Have you checked this link :
http://www.amibroker.com/library/detail.php?id=239
This i had in my records... as I do not use Ami dont know if it is valid, have it in my collection just anticipating future use if at any time...
This probably same as in above link.
cmopds=20;<br>
CMO_1=Sum( IIf( C > Ref( C, -1 ) , ( C - Ref( C ,-1 ) ) ,0 ) ,cmopds ) ;<br>
CMO_2=Sum( IIf( C < Ref( C ,-1 ) , ( Ref( C ,-1 ) - C ) ,0 ) ,cmopds );
<p>CMO=100 * (( CMO_1 -CMO_2) /( CMO_1+CMO_2));<br>
Plot(Cmo,"CMO",IIf(cmo>Ref(cmo,-1),5,4),2|styleThick);<br>
Plot(MA(Cmo,9),"Trigger",colorYellow);<br>
Plot(50,"",15);<br>
Plot(-50,"",15);<br>
Title="CMO"+WriteVal(Cmo)+" Trigger"+WriteVal(MA(Cmo,9));</p>