Click here to Login

Rules performance for different volatility regimes

Updated on 2009-08-25

In this post, we will show you how to improve your trading rules performance by splitting the generated positions and classify them using another trading rule. As an example and for the rest of the article, we will use the historical volatility level to classify the positions generated by the trading rules we want to improve.

Here is how the annualized historical volatility calculation is done. We first calculate the logarithmic returns of a security (log(close / ref(close, 1))), then we apply the standard deviation (Stddev(array, 252)) and finally we annualize the volatility by dividing it by the square root of (1 / 252) (Suppose there are 252 trading days in a year).

The result is the following formula: Stddev(log(close / ref(close, 1)), 252) / (sqrt(1 / 252)), letís call it: AnnVol.
To create the volatility regimes, we will use the (States) function.
States(AnnVol, 1|0.6|0.3|0.1) returns 0 if the annualized volatility is below 10%, one if the volatility is between 10% and 30%, two if it is between 30% and 60%, three if it is between 60% and 100% and finally four if it is above 100%.

Now letís open the Rules Manager form, and create a trading rule. For this example we have created a simple rule which is: rsi(14) > 60.
Select this rule and open the "Mass rules" form. Select the mask that will generate the "states" function (download this mask here: Historical volatility regimes) and click on "Create Rules". You will end up with 2 rules; the first one is the original trading rule. The second one, which has 5 iterations, contains two parts: your original rule + a volatility constraint.

Open the analyzer (click on Analyze), select the output (In this example, we have chosen "N-Bars stop output"), symbols, periods (Start and end date) and then start the analyzing. When the process completes, right click with your mouse button on any trading rule int the first column of the grid that displays the rules analyzing results, then select (volatilitystate). This will display a chart that shows the rules performance over the different volatility states.

In this article, we have used the annualized volatility as a way to test a rule performance over different volatility regimes. We have classified the volatility into 5 different regimes, which is an arbitrary choice.

Any other time-series can be used in substitution to the annualized volatility. We can use for example: the distance between the close price and its 200-bar moving average, or the volatility of an index, or the relative performance of a security and its index...

no comments (Log in)

QuantShare Blog
Search Posts

Recent Posts

Create Graphs using the Grid Tool
Posted 1320 days ago

Profile Graphs
Posted 1425 days ago

Previous Posts

Data snooping bias
Posted 5445 days ago

Limit and Market orders
Posted 5456 days ago

Ranking system calculation methods
Posted 5465 days ago

RSS feeds transformation
Posted 5469 days ago

Stocks: Market Capitalization
Posted 5471 days ago

Ranking System Engine
Posted 5473 days ago

More Posts


Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright © 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.