4 registered members (AndrewAMD, 20BN, Dooley, 1 invisible),
701
guests, and 0
spiders. 
Key:
Admin,
Global Mod,
Mod



Re: CyberCycle Adaptive Cy
[Re: tvas]
#448934
02/26/15 07:28
02/26/15 07:28

Joined: Dec 2013
Posts: 13
tvas
OP
Newbie

OP
Newbie
Joined: Dec 2013
Posts: 13

And here is a strategy which uses the Adaptive Cyber Cycle (Cyber Cycle's alpha1 parameter is based on the full Dominant Cycle). To make this strategy profitable you should run it in reverse mode (again: do exactly the opposite what Mr. Ehlers suggests :)) and combine it with a trailing stop exit method which is not included in the code because in TS I simply combine the strategy with the standard PercentTrailing strategy. A good result can be achieved on GBPJPY, time frame 240 min and a percent trailing exit which triggers when the profit exceeds 30 pips and risks 10% from the profit.
///////////////////////////////////////////////////////////////////// Inputs: Price((H+L)/2) ,alpha(.07), Lag(9), Reverse(false);
Vars: Smooth(0),Cycle(0),Q1(0),I1(0),DeltaPhase(0),MedianDelta(0),DC(0),InstPeriod(0),Period(0),Length(0),Num(0),Denom(0),alpha1(0),Signal(0);
Smooth = (Price + 2*Price[1] + 2*Price[2] + Price[3])/6; Cycle = (1 .5*alpha)*(1  .5*alpha)*(Smooth  2*Smooth[1] + Smooth[2]) + 2*(1  alpha)*Cycle[1]  (1  alpha)*(1  alpha)*Cycle[2]; If currentbar < 7 then Cycle = (Price  2*Price[1] + Price[2]) / 4;
Q1 = (.0962*Cycle + .5769*Cycle[2]  .5769*Cycle[4]  .0962*Cycle[6])*(.5 + .08*InstPeriod[1]); I1 = Cycle[3]; If Q1 <> 0 and Q1[1] <> 0 then DeltaPhase = (I1/Q1  I1[1]/Q1[1]) / (1 + I1*I1[1]/(Q1*Q1[1])); If DeltaPhase < 0.1 then DeltaPhase = 0.1; If DeltaPhase > 1.1 then DeltaPhase = 1.1; MedianDelta = Median(DeltaPhase, 5); If MedianDelta = 0 then DC = 15 else DC = 6.28318 / MedianDelta + .5; InstPeriod = .33*DC + .67*InstPeriod[1]; Period = .15*InstPeriod + .85*Period[1]; alpha1 = 2 / (Period + 1); Signal = (1  .5*alpha1)*(1  .5*alpha1)*(Smooth  2*Smooth[1] + Smooth[2]) + 2*(1  alpha1)*Signal[1]  (1  alpha1)*(1  alpha1)*Signal[2]; If currentbar < 7 then Signal = (Price  2*Price[1] + Price[2]) / 4;
If Reverse then begin If Signal Crosses Over Signal[1] then Buy Next Bar on Open; If Signal Crosses Under Signal[1] then Sell Short Next Bar on Open; end Else begin If Signal Crosses Under Signal[1] then Buy Next Bar on Open; If Signal Crosses Over Signal[1] then Sell Short Next Bar on Open; end;
If MarketPosition = 1 and PositionProfit < 0 and BarsSinceEntry > 8 then Sell This Bar; If MarketPosition = 1 and PositionProfit < 0 and BarsSinceEntry > 8 then Buy To Cover This Bar; ////////////////////////////////////////////////////////////////////////////////



Re: CyberCycle Adaptive Cy
[Re: forexcoder]
#475021
11/19/18 04:26
11/19/18 04:26

Joined: Aug 2018
Posts: 87
OptimusPrime
Junior Member

Junior Member
Joined: Aug 2018
Posts: 87

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<(NumBars1); i++) {
if (i<3) RevCycle[i]=Smooth[i]=ReversedSeries[i];
if (i<7 && i>2) { RevCycle[i]=( ReversedSeries[i] 2* ReversedSeries[i1] + ReversedSeries[i2]) /4;
Smooth[i] = ( ReversedSeries[i] + 2* ReversedSeries[i1] + 2*ReversedSeries[i2] + ReversedSeries[i3]);
Smooth[i]=Smooth[i]/6; } else RevCycle[i]= (1  .5*alpha)*(1  .5*alpha)*(Smooth[i]  2*Smooth[i1] + Smooth[i2]) + 2*(1  alpha)*RevCycle[i1]  (1  alpha)*(1  alpha)*RevCycle[i2];
}
iCycleCycle = rev(series(RevCycle[0]));
return iCycleCycle;
}
Thanks so much,
OptimusPrime



Re: CyberCycle Adaptive Cy
[Re: Spirit]
#475395
12/06/18 00:03
12/06/18 00:03

Joined: Aug 2018
Posts: 87
OptimusPrime
Junior Member

Junior Member
Joined: Aug 2018
Posts: 87

Hi Spirit:
I have tried to write a Variable Moving Average. This one too is not working.
What am I missing when it comes to series creation inside a function?
// NOT WORKING ///////////////////////////////////////////////////
///// Variable Moving Average /////
///////////////////////////////////////////////////
vars VariableMovingAverage (var* Input, int MAPeriod, int CMOPeriod) {
int factor = (2/((MAPeriod)+1));
vars VI = series(abs((CMO(Input, CMOPeriod))/100) );
int m = max(MAPeriod, CMOPeriod);
vars v = series(0);
int i;
for (i=(NumBars1); i>0; i) { if (i>(NumBars1m)) v[i]= Input[i]; else v[i] = (factor*VI[i]*Input[i]) + ((1factor* VI[i])* v[i+1]); } //end of loop
return v; } //end of function
Thanks so much,
OptimusPrime



Re: CyberCycle Adaptive Cy
[Re: OptimusPrime]
#475492
12/14/18 16:33
12/14/18 16:33

Joined: Aug 2018
Posts: 87
OptimusPrime
Junior Member

Junior Member
Joined: Aug 2018
Posts: 87

thanks Andrew.. I will try with those changes.
Thanks so much,
OptimusPrime



Re: CyberCycle Adaptive Cy
[Re: AndrewAMD]
#475502
12/16/18 06:26
12/16/18 06:26

Joined: Aug 2018
Posts: 87
OptimusPrime
Junior Member

Junior Member
Joined: Aug 2018
Posts: 87

Hi Andrew:
Thanks for your suggestion to make it work within the run() loop instead of giving it a separate function. Yes, it was much easier that way.
Much Appreciated.
Last edited by OptimusPrime; 12/17/18 16:06.
Thanks so much,
OptimusPrime



