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
The 'Choose' function is a small piece of code that returns a vector given an index. The function accepts six parameters, the first one is the index and it is used to select one the next five parameters. The others parameters accept any numeric vectors.
a = rsi(14);
b = rsi(14) > 50;
c = rsi(2);
d = rsi(360);
e = month() == 4;
i = 0;
f = choose(i, a, b, c, d, e);
Depending on the value of 'i', the function 'choose' will return one the following vectors: a, b, c, d or e.
The function can be very useful for optimization purpose. Suppose you have a trading system with its own buy and sell rules and you want to optimize one buy rule. You already have another five rules and want to see which one is the best. By adding, the five rules into the simulator and define an optimizable variable that varies from 0 to 4. You can easily create five trading systems and assess the performance of each one.
Another example is when using the neural network model. This function can be useful in case you want to create an input that is different for each symbol.
Here are the steps to follow if you want one more parameter to the function (You can add as many parameters as you want):
- Open the 'Custom Functions' editor
- Select 'Choose' function and click on 'Add a parameter', set the variable name to var5.
- Update the 'nbvars' variable. It must have a value of six.
- At the end of the conditional statement, add the following code: