I am more in the programming side and I got to learn more on forex so I appreciate your inputs.

So, seasonality is more like a fundamental effect (income tax declaration, harvests, unemployment rates announces), so in that case it should be useful to add to the scripts the dates of these announces, maybe the http module is useful for that.

But I still don't get the divisory line between counter-trend and cycle trading is, I have read most of 'Rocket Science for Traders' and 'Cybernetic analysis for stocks and futures' of John Ehlers and what I get is that for predicting a cycle top and low he uses among others the Sinewave Indicator which is in a nutshell a phase lead of the cycle of the market.

But in these books the Fisher Transform is also mentioned and in the Counter-Trend Workshop also it uses the Fisher Transform and uses the term 'cycle' to describe the method in some parts:

Quote:

When the Signal curve cosses the negative threshold from above - meaning when Signal falls below -1 - the price is supposedly close to the bottom of the main cycle, so we expect the price to rise and buy long. When the threshold is crossed from below - meaning Signal rises above 1 - the price is close to a peak and we buy short.


Isn't Cycle and Counter-Trend trading underlying concepts exactly the same? In other words, If I modify a Counter-Trend strategy into a Cycle strategy, wouldn't they be very correlated?

Is the workshop 5 counter trend (mean reversion) because it 'clutters' all the prices with the Fisher Transform between -1 and 1 and when one price goes outside is like going outside of a bollinger band and it should revert to the mean? If that's the case, why not simply using the prices and the bollinger bands or the standard deviation as thresholds?

Anyway, jcl, I have an old snippet which I think is a modification of the workshop 5 for cycle trading, the crossing of the "Phase" with the "Phase Lead" would indicate the bottom (buy) and top (sell) of the cycles. Do you think it makes sense? Thanks!

Code:
set(PLOTNOW);
  vars Price = series(price());
  plot("Price",Price[0],MAIN,BLACK); 
  int trend_mode = HTTrendMode(PricesLastMonth);  
  if (trend_mode)
    plot("Trend Mode",1.01*Price[0],MAIN|DOT,BLUE);    
  if (!trend_mode)
    plot("Cycle Mode",1.01*Price[0],MAIN|DOT,RED);   
  int PeriodSensibility = 30;//10
  var sinDomPhase = sin(DominantPhase(Price,PeriodSensibility));
  plot("Phase",sinDomPhase,NEW,BLACK);
  plot("Phase Lead",sin(DominantPhase(Price,PeriodSensibility)+PI/4),0,RED);
  
  var domperiod = DominantPeriod(Price,2);
  plot("Dominant Period",domperiod,NEW,BLUE);