Click here to Login

LiveZilla Live Help
LiveZilla Live Help
Trading Software Trading objects Features How-to Blog Search



Combination Element from Lexicographical Index

by QuantShare, 353 days ago
Share |






The current algorithm calculates the mathematical combination element given the lexicographical index. The function gets several string values separated by a semi-colon, a value to test, the number of values per combination and the combination index (or what is called lexicographical index).

To understand the usefulness of this function, here is an example that lets you test several stock combinations. The function returns 1 or TRUE if a specific stock or ETF symbol is found in a combination element, otherwise it returns 0 or FALSE.
- The values to be passed to the function are A;AA;B;C;GOOG;MSFT;AAPL (Stock symbols separated by a comma)
- The value to be test is the current stock symbol (The stock that is currently tested in the analyzer, simulator or screener). To get the current stock symbol, we use the function: Name()
- The number of values per combinations (K) is set to 3

Given a K value of 3 and an N value of 7 (7 stock symbols passed in the first argument of our function), the total number of combinations is: 35

Combination 0: A;AA;B
Combination 1: A;AA;C
Combination 2: A;AA;GOOG
....
Combination 34: GOOG;MSFT;AAPL

By passing a lexicographical index of 34, the function calculates the combination string (GOOG;MSFT;AAPL) and tests whether the stock symbol provided in the second argument of our function is included in this string. In case we are analyzing Citigroup Inc. (C), the response is no and the trading function returns 0.

If we vary the lexicographical index from 0 to 34, we can test all stock names combinations. In a trading system, the formula may look like this:

Optimize("lexindex", 0, 34, 1);
buy = CombinationIndex("A;AA;B;C;GOOG;MSFT;AAPL", Name(), 3, lexindex) == 1;


An example of using this function is to test a strategy that combines different ETF or Stock symbols to check which combination of assets perform best.

Note: You can get the total number of combinations by setting the lexicographical index to -1.

nb1 = CombinationIndex("A;AA;B;C;GOOG;MSFT;AAPL", Name(), 3, -1);
Optimize("lexindex", 0, nb1, 1);


Share This ->
Share |


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




Type: Trading Indicator

Object ID: 977


Country:
All

Market: All

Style:
Technical Analysis

Reviews
You must log in first

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
Hull 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 23 Notes Report an item
TSI - True Strength Index (by saratur, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads 22 Notes Report an item
Percentile - Percent Rank of a Trading 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 42 Notes Report an item
Relative Performance/Return Chart - Compare Several Assets/Stocks (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 21 Notes Report an item
The DeMark's DeMarker 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 48 Notes Report an item
calcA (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 7 Notes Report an item
Strategy Optimization on Random in-sample and out-of-sample Periods (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 10 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



Random Blog Posts

How to turn any ordinary trading strategy into a very profitable one

Charting & Scripts - Manage stock charts using the global script

Trading System: Buy Stocks based on their Sharpe Ratio Rank

Creating and managing notes for your stocks

Create a Trading Strategy using Portfolio123 Ranking Systems

How to Quickly Create Fundamental Scans

Download Trading Data using the Post-Script

Download Trading Data using the Pre-Script

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
Affiliate Program
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