This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.
OKWe may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.
Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.
These cookies are strictly necessary to provide you with services available through our website and to use some of its features.
Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.
We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.
We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.
These cookies collect information that is used either in aggregate form to help us understand how our website is being used or how effective our marketing campaigns are, or to help us customize our website and application for you in order to enhance your experience.
If you do not want that we track your visit to our site you can disable tracking in your browser here:
We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.
Google Webfont Settings:
Google Map Settings:
Google reCaptcha Settings:
Vimeo and Youtube video embeds:
The following cookies are also needed - You can choose if you want to allow them:
You can read about our cookies and privacy settings in detail on our Privacy Policy Page.
Privacy Policy
Book Part 2 “Metonic Cycles” now available
/in Frontpage Article, Publications/by LvTI am proud to inform you about the release of the new Book Part 2 “Metonic Cycles”. A lot of content and examples have been added – so it is a real new book compared to the first initial release in 2010. Endless nights and hours of work have gone into it.
This second book of our series introduces correlations between markets and external energy cycles like gravity and geomagnetism. Digital signal processing techniques are used to reverse engineer Gann’s master cycles, resulting in a 100% mechanical cycle-based trading system that has shown a compounded growth rate of 20% per year over the last 30 years when back-tested using the Dow.
In addition, it introduces new non-linear indicators and reviews the significance of a cyclic sentiment predictor for the Dow Jones Industrial Average Index. To that end, using daily data covering the period from 1935 to 2013, ancient cycles are condidered as predictors to forecast daily sentiment for years ahead of time.
Forecasts, plotted as an non-linear indicators, are transformed into a mechanical trading rule whose profitability has been evaluated against the major markets buy-and-hold performance of 1990-2013. The results suggest that trading based on non-linear indicators (“cyclic time”) significantly outperforms the linear-time based indicator strategies in nearly all performance metrics, including net return, profitability, and Sharpe ratio.
Includes TradeStation / EasyLanguage code to rebuild indicators and use the trading system. Generic pseudo code and step-by-step guidelines included.
The book is available via CreateSpace / Amazon. Order your book here:
HOW-TO: Scripting AND/OR/IF rules to generate trade entry/exit signales
/in Knowledge & Academy/by LvTAs the scripting engine was updated for performance reasons, AND/OR conditions must now be coded in mathematical terms. The follwing examples show how to code AND/OR statements to produce final trade entry/exit signals in comparison to the “old” scripting format.
Example 1 – Bollinger Bands Script:
Old Version:
SET BOTTOM = BBB(CLOSE, $N3, $N4, EXPONENTIAL)
SET TOP = BBT(CLOSE, $N3, $N4, EXPONENTIAL)
((REF(CLOSE, 1) > REF(TOP, 1)) AND CLOSE < TOP) OR CLOSE < BOTTOM * 0.98
New Version:
SET BOTTOM = BBB(CLOSE, $N3, $N4, EXPONENTIAL)
SET TOP = BBT(CLOSE, $N3, $N4, EXPONENTIAL)
SET s1 = ((REF(CLOSE, 1) > REF(TOP, 1)) + (CLOSE < TOP))
SET s2 = (CLOSE < (BOTTOM * 0.98))
SET sellsignal = (s1>1) + (s2>0)
if (sellsignal>=1,true,false)
Example 2 – Simple CSI Turnover Script:
Idea: Generate sell signal if indicator is above dynamic OB line and turns down and generate buy signal if indicator is below dynamic OS line and turns up. Here is the script to capture the turns of the indicator if it is above/below the bands:
Buy Script:
#set values
set csi = lvtcsi(40,0.1)
set lowband = lvtcsilb(40,0.1)
#generate critea
set oversold = csi < lowband
set upturn = CROSSOVER(csi> REF(csi,1), 0.5)
#build AND signal condition
set buysignal = upturn + oversold
#check if signal was generated
if (buysignal=2,true,false)
– SHORT BUY SCRIPT VERSION –
set csi = lvtcsi(40,0.1)
set buysignal = (CROSSOVER(csi> REF(csi,1), 0.5) + (csi<lvtcsilb(40,0.1)))
if (buysignal=2,true,false)
Sell Script:
#set values
set csi = lvtcsi(40,0.1)
set highband = lvtcsiub(40,0.1)
#generate critea
set overbought = csi > highband
set downturn = CROSSOVER(csi< REF(csi,1), 0.5)
#build AND signal condition
set sellsignal = downturn + overbought
#check if signal was generated
if (sellsignal=2,true,false)
– SHORT SELL SCRIPT VERSION –
set csi = lvtcsi(40,0.1)
set sellsignal = (CROSSOVER(csi< REF(csi,1), 0.5) + (csi>lvtcsiub(40,0.1)))
if (sellsignal=2,true,false)
Example 3 – Combination of Indicators
OLD SCRIPT:
TREND(EMA(CLOSE,20),15) = DOWN
AND TREND(MACD(13,26,9,SIMPLE),5) = DOWN
NEW SELL SCRIPT:
# setup indicators
SET T1 = TREND(EMA(CLOSE,20),15)
SET T2 = TREND(MACD(13,26,9,SIMPLE),5)
# build final signal with AND condition
# make sure that no UP or SIDEWAYS trend is active in T1 AND T2
set sellsignal = (t1<3) + (t1>1) + (t2>1) + (t2<3)
# evaluate to true if AND statement is given (sellsignal must be =4)
if(sellsignal=4,true,false)
[…]
You must have membership level. Please go to whentotrade.com to configure your account.
[…]
Nonlinear Science: Evidence of synchronous, decadal to billion year cycles in geological, genetic, and astronomical events
/in Science & Research/by LvTStephen Puetz has done a lot of work on cycles reserach and cycles impacting financial datasets. I highly recommend his book “Unified Cycle Theory” and his current work. He has recently published a new article in the Journal “Chaos, Solitons & Fractals” which aims to be a leading journal in the interdisciplinary field of Nonlinear Science, and Nonequilibrium and Complex Phenomena.
He also states the dynamic nature of cycles in this article:
Source: “Evidence of synchronous, decadal to billion year cycles in geological, genetic, and astronomical events”, Chaos, Solitons & Fractals,Volumes 62–63, May–June 2014, Pages 55–75.
The paper is available as Open Access article in the Journal database and can be downloaded as pdf. It is a scientific research paper and has no direct relation to trading purposes. However, an important publication on nonlinear, extra-terrestrical cycles.
http://www.sciencedirect.com/science/article/pii/S0960077914000472
Title:
Evidence of synchronous, decadal to billion year cycles in geological, genetic, and astronomical events
Abstract:
Studies on continuously improving records of geological, biological, and astronomical events and processes led to increased awareness of common cycles in the records. Here we enhance the analytical scope of earlier discoveries by showing that most of these cycles occur in unison, as a harmonic series. The cycles oscillate in multiples of three, cascading into a period-tripled set of cycles. We provide one equation combining the characteristics of 32 theoretical cycles, with periods ranging from 57.3 years to 1.64 billion years. Our statistical tests show that the astronomical and geological cycles are phase-locked synchronously, while the biological cycles lag. This synchrony suggests a common astronomical cause for geological and biological cycles. This suggests that divisible matter is distributed fractally throughout the universe, as postulated by fractal cosmologies, bifurcation theory, and chaos theory.
Author:
Stephen J. Puetz, Andreas Prokophb, Glenn Borchardtd, Edward W. Masond
Date published:
April 2014
Trading Intraday Volume Cycles Using a Genetic Algorithm
/in Knowledge & Academy, Publications/by LvTDetect Intraday Volume Cycles for the E-mini S&P 500 Futures using a Genetic Algorithm
One of the ways of analyzing cycles in financial data is to detect cycles in traded volume. In particular, there are interesting correlations between the fixed amount of volume traded and price reversals in intraday trading. If you are able to detect these static volume figures that can explain intraday price movements, you have an edge for your trading strategy.Thus, instead of time-based cycles, it makes much sense to look for fixed amount of volume cycles to spot market turns.
However, once you have detected the active correlations between volume cycles and price movements, this behavior will not remain static. It is, therefore, quite difficult to keep pace with the dominant volume cycles as these cycles are dynamic. On a daily basis, the volume cycles will adjust according to the traders available as they represent the available volume that needs to be traded in either direction for the direction of the price movement to change.
A genetic algorithm (GA) is a promising way to detect volume cycles and to incorporate the flow of traders intraday. It is a new alternative to using digital signal processing for detecting possible cycles. Akin to chromosomes in a genome, a GA will check possible cycle length settings for long, short, and exit signals. The genome transforms based on an evolutionary process that involves mutation, crossover, and survival of the fittest. Similarly, based on a random population of cycle genomes, the GA will evolve to detect useful volume cycles at different starting points and optimize these cycles based on the rules of natural evolution. Each genome is measured against a special fitness function that simply checks the equity curve if you would have traded these volume cycles.
This strategy requires a charting and analysis platform that can chart the data, apply cycle analysis, use GAs, and apply alerts based on the strategies identified for real-time trading. The WhenToTrade charting software allows you to incorporate all these requirements into your trading strategy.
The following example illustrates the application of this strategy of trading volume cycles in practice. The strategy was actually applied before market hours and has been recorded live during the trading session. Thus, you can review the trade result through the video link at the end of this article.
Setting up the chart before the trading day starts
This strategy uses an 8000 volume chart for the S&P500 eMini futures; that is, a bar will be plotted after the trading volume has reached 8k. Thus, the x-axis indicates a linear fixed amount of volume and not time. Thus, the cycle length in these charts does not represent a fixed time period, but a fixed amount of volume.
In our example, we set our intraday trading strategy on January 17 2014 at 7:00 am NY time, one hour before the major US market opens. We apply the GA to the data for the prior two weeks in order to evolve the cycle genomes. Data from January 2–15 is used for the GA process. Data for the out-of-sample period, January 15–16, is used to verify the results.
We use the relative strength index (RSI) to analyze the volume cycles on the price chart for this realtime example. The RSI works as an oscillator and is cyclical in nature; therefore, it can be used to detect cycles. Once the RSI for the volume bars crosses a special value, a signal will be generated. Each trading signal has two parameters—a length setting for the RSI and an individual threshold value that represents the cut-off value for the signal to be generated. The combination of the crossover threshold and the RSI length represents fixed active cycle measures through the RSI indicator. We allow individual combinations of these parameters for long, short, and exit signals. Thus, we assume that different volumne cycles are active to trigger long and short signals. This enables us to remain in sync with the real characteristics of traders’ emotions, as short cycles are mostly faster and sharper than long cycles.
The generic script to apply this signal is as follows:
CROSSOVER(
RSI(close,LENGTH), TRESHOLD )
The GA was run for just 3–5 minutes and the fittest genomes from the population were identified. There is an important benefit of GA over brute force optimization algorithms:
A brute force technique checks each parameter combination for local optima. For our example, this would imply the following search space: The RSI length can take values between 5–35 and the crossover threshold can take 30 different values. Thus, each independent signal can have 30*30=900 possible parameter combinations. This results in a search space of over 600 billion possible trading strategies (900x900x900x900).
A brute force algorithm must check all combinations for the best combination. In most cases, this is not possible within a short period and, therefore, not applicable in an intraday trading setup where the results are required in the morning before the market opens. On the other hand, the GA can spot profitable combinations within three minutes in this huge search space based on the rules of natural evolution. The process of natural evolution is more similar to the behavior of cycles and the dynamic component within the markets. Thus, the characteristics of GA are similar to the way cycles drive financial markets.
Picture 2 plots the trading system characteristics for each genome identified from the population. The genomes are sorted by the fitness function that seeks constant upward sloping equity curves based on the given fitness criteria.
The GA was able to detect cycles within the RSI oscillator of the volume chart that generated a profitability of 76% or 86 e-mini futures points from January 2-15. The equity curve is a constant upward sloping line that indicates constant profit per trade and low risk. Even the out-of-sample equity curve for the last two days (the area to the right of the red line) exhibits the same behavior, which is promising.
Attach the “fittest” cycles found by the GA to realtime trading chart
Based on these statistics, the GA seems to be fit to be applied to real market conditions. Thus, we applied this system to live market conditions. The scripts generated in the right panel of Picture 2 can now be incorporated into any real-time alerting module. The WTT platform includes an alert generator. Thus, the scripts along with the parameters were incorporated into the live alert engine and activated a few minutes before the market opens. In Picture 3, the line “ALERT START” indicates when the alert was applied. From that point in time, the system is monitoring the volume chart according to the rules and real-time incoming signals. The alerts are shown in a special alert window and are directly plotted on the chart as red and green arrows in real time as new bars are plotted.
Picture 3 depicts the results after the trading setup was applied to the chart at market open. The arrows were plotted in real time.
As seen in Picture 3, our detected cycle parameter combinations for the entry and exit signals generated eight trades during the day. Of these eight trades, seven were profitable and generated a total profit of over 11 e-mini futures points for the trading day. The trades shown in the chart have not been incorporated ex-post. This behavior was recorded during the day and you can watch the script in live mode where the last two signals are generated in the chart during the live recording. The video link for this trading day is at the end of this article.
This example demonstrates the power of combining cycle analysis, volume charts, and GAs. Thus, it highlights the power of what is possible if you have the knowledge and tools at hand to utilize the power of cycles and GAs. This article shows how to apply a genetic engine to prepare your trading systems for the trading day.
A PDF version of the article is available for download/print.
The trading chart in large scale is available here in full screen: SHOW LARGE PICTURE 3
Realtime video snapshot of the live trading session
The real-time video, that shows (1) that the GA was run before market open and (2) the method of monitoring the signals generated in real time, is available here:
New Charting Module update available
/in General News, Software Updates/by LvTWe have added some enhancements and have released the update to the My Account / Download area for registered clients. Please view the ChangeLog for more details.
MIT OpenCourseware: Learning – Genetic Algorithms
/in Science & Research/by LvTThis lecture explores genetic algorithms at a conceptual level. Good stuff if you want to understand the background of a GA. I recommend only for colleagues with an engineering/math background. Not related to financial markets. Pure algorithm.
We have implemented a Genetic Algorithm into the WTT platform. Please see our info page.