Join Now or Login

Create an account to download QuantShare for FREE. This account allows you also to download trading objects from our sharing server.

Log in with your facebook-account:





Recent Posts

New features in QuantShare - Trading Software
Posted Yesterday

Technical Analysis Using Multiple Timeframes
Posted 9 days ago

Short Index - Part 2
Posted 16 days ago

Short Index - Part 1
Posted 23 days ago

Trend Following and Moving Averages
Posted 30 days ago

Show All

Shared Trading Objects
Show All
Hong Kong Stock Exchange - historical data (by The trader, uploaded 108 days ago)
No notes
Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Report an item
Recent mergers and acquisitions (by Patrick Fonce, uploaded 265 days ago)
No notes
Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Report an item
Toronto Stock Exchange (by bug man, uploaded 118 days ago)
No notes
Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Report an item
Bonds: Treasury Inflation-Protected Securities (TIPS) (by The trader, uploaded 224 days ago)
No notes
Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Report an item
Bourse de Tunis - EOD data (by Tom Huggens, uploaded 51 days ago)
No notes
Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Report an item
Market: Canada Holidays (by Patrick Fonce, uploaded 104 days ago)
No notes
Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Report an item
Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

Example of advanced rule

Updated on 2009-06-10 13:21:59


In this tutorial we are going to explain how to create advanced rules and how to back-test them.

Imagine you want to detect the following pattern:

- A stock rise more than 40% in a period of 30-90 days
- then drop between 10% and 20% in a period of 5-15 days
- then rise again above the close price where the last condition occurred, in a period that doesn't exceed 20 days

You can see from the pattern above, how difficult it would be to implement it using standard trading software formulas, but it is very easy to detect any pattern using the advanced rules of QuantShare, you just need to learn how the formula works and what are the different available functions.
NB: use CTRL+SPACE to display the list of available functions, the functions that start with '_' can be used only in SEARCHFOR and OUTPUT syntax.

This is the formula for the above pattern:

var1 = SEARCHFOR _perf(close) > 40 after 30 within 60
THEN (_perf(close) < -10 && _perf(close) > -20) after 5 within 10
THEN close > _ref(close) within 20;
Plot(var1 , "Pattern", colorLime|55|colorLime|64|0, ChartBar, StyleOwnScale);


_perf: means performance (in percentage).

This is a picture of the signal generated by this pattern.



The first triangle point out the first condition (stock rise more than 40%...).
The second triangle point out the second condition.
The third (green) triangle point out the bar at which the pattern has occurred (third condition).

As you can see in the picture above, when the first condition occurs the stock was not making a new high.
We can change that by adding a new rule in the first condition.
The new formula will be:

var1 = SEARCHFOR (_perf(close) > 40 && close >= hhv(close, 50)) after 30 within 60
THEN (_perf(close) < -10 && _perf(close) > -20) after 5 within 10
THEN close > _ref(close) within 20;
Plot(var1 , "Pattern", colorLime|55|colorLime|64|0, ChartBar, StyleOwnScale);


We added a condition:
close >= hhv(close, 50), that tells the software that we want the first condition to occur when the stock is making a new high.



Now open the 'Rules Manager' (Analysis->Rules Manager), create a new list of rules, and then add the following rule:

SEARCHFOR (_perf(close) > a && close >= hhv(close, 50)) after b within c
THEN (_perf(close) < -d && _perf(close) > -e) after 5 within 10
THEN close > _ref(close) within f


Update the variables, then click on 'Add'

a from 30 to 50, with a step of 10
b from 10 to 40, with a step of 10
c from 40 to 80, with a step of 20
d from 10 to 15, with a step of 5
e from 20 to 30, with a step of 10
f from 10 to 40, with a step of 10



We have just created 576 rules, you can now back-test them.

This is just an example of how powerful the advanced rules can be.
The pattern we have just created appears to be non profitable.








no reviews (Log in)

Posts

Example of advanced rule
Posted 281 days ago

Beta release
Posted 283 days ago

Back



contactus
About | Privacy | Terms of Use | Manual
Copyright © 2010 QUANTSHARE.COM