Hi Team:
Forgive the crude attempt, but I am trying to code the CyberCycle Internal Cycle.. It is giving an error message :
" Error 111: Crash in Function at Bar 0"
but I can't find the issue right now.
vars CyberCycleInternalCycle (var* Input, alpha)
{
vars ReversedSeries = rev(series(Input[0]));
vars RevCycle,iCycleCycle,Smooth = series();
int i=0;
for(i=0; i<(NumBars-1); i++)
{
if (i<3)
RevCycle[i]=Smooth[i]=ReversedSeries[i];
if (i<7 && i>2)
{
RevCycle[i]=(
ReversedSeries[i]
-2* ReversedSeries[i-1]
+ ReversedSeries[i-2]) /4;
Smooth[i] = (
ReversedSeries[i]
+ 2* ReversedSeries[i-1]
+ 2*ReversedSeries[i-2]
+ ReversedSeries[i-3]);
Smooth[i]=Smooth[i]/6;
}
else
RevCycle[i]=
(1 - .5*alpha)*(1 - .5*alpha)*(Smooth[i]
- 2*Smooth[i-1]
+ Smooth[i-2])
+ 2*(1 - alpha)*RevCycle[i-1]
- (1 - alpha)*(1 - alpha)*RevCycle[i-2];
}
iCycleCycle = rev(series(RevCycle[0]));
return iCycleCycle;
}