Click here to Login

Trading Software Trading objects Features How-to Blog Search



Market trading rules

by bug man, 760 days ago
Share |

This function accepts a list of rules and an index as parameters and returns a rule for the specified index.
The Market trading rules function can be very useful when applied in an optimization or backtesting process. Imagine you have a trading system and you would like to test different exit strategies. You first need to compile a list of rules that will be used as exits.
Let us say, these are your exit rules:
rsi(14) < 30
roc(close, 2) < -10
sma(volume, 30) < sma(volume, 10)
close < ref(close, 1) && ref(close, 1) < ref(close, 2)

And this is your trading system:
buy = sma(30) > sma(14) && roc(close, 20) < -10 && roc(close, 2) > 3;
sell = ??

Because you have four exit rules, you would like to test four strategies. You can of course create a trading system for each exit rule or you can use this market trading rules function and only one trading system to accomplish the same result. The usefulness of this function may not seem obvious with this example, however if you had more than 20 exit rules to test then this function will save you a lot of time.
Here is a trading system based on the market trading rules function:
Optimize("varindex", 0, 3, 1);
buy = sma(30) > sma(14) && roc(close, 20) < -10 && roc(close, 2) > 3;
sell = rules_select("rsi(14) < 30;roc(close, 2) < -10;sma(volume, 30) < sma(volume, 10);close < ref(close, 1) && ref(close, 1) < ref(close, 2)", varindex);

When you optimize this strategy, the variable 'varindex' will varies from 0 to 3 and this in turn will create 4 strategies.

You can also use this function to create more variations and combinations. Instead of using the function once, you can use it several times, each time with the same rules or different ones. This will create several combinations.
Example:
Optimize("varindex1", 0, 2, 1);
Optimize("varindex2", 0, 1, 1);
s1 = rules_select("rule1;rule2;rule3", varindex1)
s2 = rules_select("rule4;rule5", varindex2)
sell = s1 || s2;

The above example will create six strategies. You can calculate the number of combinations by multiplying the number of iterations in every function (3 * 2 = 6).
Here is the list of all the generated trading rules combinations:
sell = rule1 || rule4;
sell = rule1 || rule5;
sell = rule2 || rule4;
sell = rule2 || rule5;
sell = rule3 || rule4;
sell = rule3 || rule5;

The rules passed to the Market trading rules function must be separated by a semi-colon and must be entered as a string (between quotes).


Share This ->
Share |


You have to log in to bookmark this object
What is this?
Additional Information



>>>> More trading objects? click here to search for trading sytems, downloaders, screens, custom drawing tools, indicators... by country, market or style.

>>>> To get this item and hundreds of other items, click here to join and download the Best Trading Software for Free .



No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Write a review no reviews Number of downloads 13 downloads Notes Report an item


Type: Trading Indicator

Object ID: 326


Country:
All

Market: All

Style:
Technical Analysis




Related Trading Objects



Country
Page 1
Trading the Equity Curve
by QuantShare, uploaded several months ago


No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 4 Notes Report an item
Opening Range Breakout Indicator
by QuantShare, uploaded several months ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 3 Notes Report an item
Wilder's Smoothing - Moving Average
by QuantShare, uploaded several months ago
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 9 Notes 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









Join now
and get instant access for free to the trading software, the Sharing server and the Social network website.
Click here


Related objects
Show All
SafeZone Stop (by Brian Brown, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 27 Notes Report an item
Fisher Transform - Technical Indicator (by bug man, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 38 Notes Report an item
Advancing-Declining-Unchanged volume for NYSE, AMEX and NASDAQ (by The trader, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 25 Notes Report an item
Futures and Forex historical data (by Tom Huggens, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 763 Notes Report an item
Futures symbols (by Tom Huggens, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 388 Notes Report an item
How far are the close prices from the support line (by The trader, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 24 Notes Report an item
Chart Patterns: Double Top and Double Bottom (by bug man, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 17 Notes 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

Technical Analysis


Fundamental Analysis


Forum Threads



Random Blog Posts

Stock split & dividend

Survivorship bias

Transaction Costs

How scripts communicate with each other

How to simulate options strategies

Organizing Trading Objects

Creating a download item: Initial Jobless Claims

How to search for a download item

Show All

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






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

Copyright © 2012 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items