Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, Edgar_Herrera), 804 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Differences between Cycles, Mean reversion and Seasonality #445258
09/01/14 18:47
09/01/14 18:47
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
According to the manual quote below, there are -among other trading systems- Mean reversion, Cycles and Seasonality trading but for my understanding they are the same. In workshop 5 it uses counter trend and I think that the spectral analysis example in the manual: http://zorro-trader.com/manual/en/strategy.htm suggests tackling it with the same counter trend algo used in workshop 5.

I would highly appreciate any explanation or a mini example of using Cycles and Seasonality strategies. Thanks beforehand!

Quote:


* Trend. All strategies try to anticipate the trend, but the current trend of a price curve itself can be used to predict future prices. Traders tend to follow the mass: when some buy, others start buying too. This causes a sequence of price movements in the same direction that can be detected and exploited. Trend following is one of the most often used strategies, but also one of the most difficult: the crucial point is detecting a beginning trend as early as possible, while at the same time preventing false signals. An example of a trend trading strategy can be found in Workshop 4.

* Mean reversion (counter-trend). Traders often believe in the existence of a 'fair price' of an asset. They buy when the actual price is cheaper than it ought to be in their opinion, or sell when it is more expensive. This causes the price curve after going in a certain direction often to reverse back to the mean. An example of a mean reversion strategy can be found in Workshop 5.

* Cycles. When a trade is profitable, traders often sell after a certain time for taking profits; unprofitable trades are sold after a different time. This has often the effect to synchronize entries and exits among a large number of traders, and causes the price curve to oscillate with a period that is stable over a relatively long time span. Such a cycle can be detected with spectral analysis functions and used for predicting the price trend. (Those cycles in price curves are real and unrelated to the imagined "waves" mentioned below).

* Clusters. Traders often believe in a 'real price' of a certain asset, and sell or buy a position at the moment when the price curve reached that value. This is the reason that prices sometimes cluster at certain levels and produce the famous "support" and "resistance" lines (also called "supply" and "demand").

* Curve patterns. Traders believe that price movements are preceded by certain curve patterns. Most of them - such as the famous "head and shoulders" pattern - are myths. But some patterns, for instance "cups" or "half-cups", can indeed precede an upwards or downwards movement and can be exploited by pattern-detecting methods such as the Fréchet algorithm.

* Price action. Certain configurations of the open, close, high, or low prices of 3, 4, or 5 consecutive candles are said to predict price movements. Problem is that predictive candle patterns can't be found in books - they depend on the market, the broker's liquidity providers, and on the time zone, and thus change all the time. But done the right way, price action trading can indeed generate profit with candle patterns that are found by statistical analysis. An example for detecting profitable candle patterns with a machine learning algorithm can be found in Workshop 7.

* Price cap. Sometimes a governement establishes a floor or ceiling for its currency exchange rate. Interventions prevent that the exchange rate exceeds a certain limit - a famous example is the above mentioned 1.20 ceiling of the EUR/CHF rate. This can be used in strategies to the trader's advantage.

* Seasonality. "Season" does not necessarily mean a season of a year. Monthly, weekly, or daily trading behavior at large stock exchanges, such as the NYSE, often follows a certain pattern that can be exploited by strategies. For instance, the S&P500 index often moves upwards in the first days of a month, and also has often an upwards trend in the early morning hours before the main trading session of the day. You can detect seasonal effects with Zorro's Profile functions.

* Gaps. When an asset is traded during certain market hours only - such as stocks and stock indices - tomorrow's market open price can sometimes be predicted to some degree from the trading behavior at today's market close time.

* Arbitrage. When two assets are known to be strongly correlated, strategies can exploit the fact that their prices tend to regularly end up at the same level or the same ratio, and derive profit from temporary price deviations.

* Price shocks. They often happen on Monday or on Friday morning when companies or organizations publish good or bad news that affect the market. Even without knowing the news, a strategy can detect the first price reactions and quickly jump onto the bandwagon.

Re: Differences between Cycles, Mean reversion and Seasonality [Re: Mithrandir77] #445315
09/03/14 12:46
09/03/14 12:46
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
I have no example of seasonality trading. But it should be easy to write when you know which seasonality you want to exploit.

A mean reversion example is workshop 5. This example can be modified for cycle trading. You can use a similar filtering and only need a different trigger condition that enters when the cycle begins to swing upwards or downwards. Various examples of cycle trading can be found in Ehler's books.

Re: Differences between Cycles, Mean reversion and Seasonality [Re: jcl] #445350
09/05/14 04:37
09/05/14 04:37
Joined: Dec 2013
Posts: 82
Sydney, NSW
T
Thirstywolf Offline
Junior Member
Thirstywolf  Offline
Junior Member
T

Joined: Dec 2013
Posts: 82
Sydney, NSW
There are some obvious seasonality trades if you think about it. Stock markets generally rally into earnings/dividends season as there is a very quick return coming, and then tend to sell off afterwards.

Although I know little about commodities, I know there are yearly weather/harvest related trades on soft commodities, probably in the form of spreads.

Plenty of examples if you really start to think about it.

Re: Differences between Cycles, Mean reversion and Seasonality [Re: Thirstywolf] #445351
09/05/14 06:19
09/05/14 06:19
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline OP
Member
Mithrandir77  Offline OP
Member

Joined: Nov 2013
Posts: 123
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);


Re: Differences between Cycles, Mean reversion and Seasonality [Re: Mithrandir77] #445354
09/05/14 09:54
09/05/14 09:54
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Yes, the concept makes sense. I would define the difference between counter trend and cycle trading in this way:

Cycle trading attempts to identify a dominant cycle and buys/sells its bottoms and tops.

Counter trend trading buys when the price moved down by a certain amount, and sells when it moved up by a certain amount. It can very well use a cycle for determining what a "certain amount" is. But it does not enter at bottoms and tops, but when the cycle goes below/above a certain threshold.

Re: Differences between Cycles, Mean reversion and Seasonality [Re: jcl] #455183
10/12/15 15:11
10/12/15 15:11
Joined: Mar 2015
Posts: 336
Rogaland
N
nanotir Offline
Senior Member
nanotir  Offline
Senior Member
N

Joined: Mar 2015
Posts: 336
Rogaland
Nice explanation jcl.
It would be interesting to test what is better, to enter in the valley or in the cross.

"why not simply using the prices and the bollinger bands or the standard deviation as thresholds"
Well... as Ehers describes in the fisher transformation paper. bollinger bands consider that the price follows a gaussian distribution it does not. That´s why he uses the fisher transformation so that it is more realistic when the price move out from the mean.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1