This is a trading item or a component that was created using QuantShare by one of our members.
This item can be downloaded and used by QuantShare Trading Software.
Trading items are of different types. There are data downloaders, trading indicators, trading systems, watchlists, composites/indices...
You can use this item and hundreds of others for free by downloading QuantShare.
Top Reasons Why You Should Use QuantShare:
Works with US and international markets (stock, forex, options, futures, ETF...)
Offers you the tools that will help you become a profitable trader
Allows you to implement any trading ideas
Exchange items and ideas with other QuantShare users
Our support team is very responsive and will answer any of your questions
We will implement any features you suggest
Very low price and much more features than the majority of other trading software
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).
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.