Click here to Login




4 indicators to create adaptive trading systems

Updated on 2011-11-07





Adaptive trading systems are strategies that can "learn" from the market and assets data history and consequently adapt its rules to the new market dynamics. A self or auto adaptive trading system can adjust its buy and sell rules depending on the performance of these rules in the past.

An example would be to create a trading system based on a single buy rule and then switch off and on this rule depending on the performance of the latter in the past 2 years.

The trading system could be as simple as buying a stock when its 14-bar relative strength index (RSI) is higher than 70. This strategy can be transformed into an adaptive trading system by adding a rule that analyze or backtest the first rule, in the past, and then return its performance or any other metric. We then check the simulation measure and make decision based on it. Example: Switch off the RSI rule if the measure is negative.

Here are four trading indicators that can help you create adaptive trading systems. These indicators were created using the "Create Function" tool of QuantShare trading software. They are available in the sharing server and can be easily modified to suit your needs.


Buy Indicator

The Buy Indicator is a very powerful function that analyzes the performance of a trading rule over the specified number of bars. For each trading bar, it calculates the average return of the different trades that were generated during the previous N bars. Each trade is taken when the provided buy rule is TRUE and is exited after a specific number of bars (N-Bar Stop rule).

Example:
rule1 = close > sma(30);
buy = rule1 and BuyInd(rule1, 20, 250) > 0;


Buy a stock when the price is higher than its 30-Bar moving average and when the average return of trades generated by "rule1", in the last year, is positive. The adaptive trading strategy uses a 20-bar stop as exit rule.

During a simulation, this indicator allows you to perform backtests within a backtest.

Indicator download link: Buy Indicator


Simulation/Backtest Trading Indicator

This is a variation of the Buy Indicator. The function contains an additional parameter that lets you specify a minimum number of trades. The strategy return is set to zero if the number of trades generated by this adaptive rule (for each trading bar) is below this number.
Here is an example based on two trading rules:
rule1 = close == hhv(close, 5);
rule2 = volume > 2*sma(volume, 20);
buy = rule1 and rule2 and BuyInd1(rule1, 5, 10, 250) > 0 and BuyInd1(rule2, 5, 10, 250) > 0;


A buy signal is generated if:
- The stock is making a new 5-day high (Rule1)
- The volume is two times higher than the average volume of the past 20 bars (Rule2)
- Average return of trades generated based on "Rule1", in the past year, is positive
- Same strategy based on "Rule2" is profitable

Indicator download link: Simulation/Backtest Trading Indicator


Buy Sell Simulation Indicator

This Buy/Sell Simulation function is almost similar to the "Buy Indicator" with the difference that it allows you to specify an exit rule (for the internal backtesting) and a minimum number of trades to consider in order to validate the strategy result.

Sell Rule: Trade returns will be calculated based on the specified buy and sell rule. Note that in the "Buy Indicator" the sell rule was an N-Bar stop.
Minimum Trades: After the internal backtesting is performed (for each bar), the function checks the number of trades and compares it to this value. It the number of trades is below the minimum threshold then the strategy return is set to zero.

Example:
rule1 = close > sma(30);
buy = rule1 and BuySellSim(rule1, !rule1, 10, 250) > 0;


In the above example, the exit rule of the adaptive strategy consists of selling the security if the simple moving average is higher or equal to the close price.
Note that by using "10" as minimum number of trades, the simulator or portfolio will never enter a new position (no signal) if there are less than 10 similar trades for the security in the past year.

Indicator download link: Buy Sell Simulation Indicator


Strategy Indicator - Percent winning trades for a trading rule

As the previous ones, this indicator acts as a simulator or backtester and returns a measure based on trades generated in the past N-bars. The measure that is returned by this function is the percentage of winning trades.

Indicator download link: Strategy Indicator - Percent winning trades for a trading rule


Adaptive trading rules can be used to trade stocks, ETFs, Forex, futures and any other financial assets.
Besides the previous indicator, the other ones use the average trade returns as metric. Of course, adaptive trading systems can be based on other metrics, such as the annual return, Sharpe ratio, Sortino ratio, maximum drawdown, standard deviation...
All you have to do is create new adaptive functions or modify the formula of the existing ones.











no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1463 days ago

Profile Graphs
Posted 1568 days ago

QuantShare
Previous Posts

More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
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.