Nate - I wanted to thank you for your sharing of your collection of trading based technical indicators.
I wanted to share similar work with you and your followers in the hopes that some may find it complimentary and useful. As it isn't a file submission direct to Mathworks I really can't create my own thread.
I have created a C++ mex-able wrapper for the open source TA-LIB library of functions.
It is available in the repository of http://www.openAlgo.org
Thank you for this collection. On a cursory read of the code, if I am correct there is an issue with the logic employed in tradeSignal if I have understood it correctly. Specifically, the input 'ind' and logical 'AND'. As I understand it, 'ind' is normalized such that 0 = sell, 0.5 = "skip", 1 = buy. If you logically AND 0 & 1 (sell and buy) the result is a 0 (sell) however this is not the desired result. I'm posting this in the spirit of others trying to review this code and welcome any correction on my understanding.
Sanjaya, regarding your second question, try setting the 'ConstrBoundary' option to 'penalize'. Regarding your first question, my code should be able to handle as any variables as you are willing to throw at it, but unfortunately it is not able to handle mixed integer problems. The Genetic Algorithm included in MATLAB's Global Optimzation Toolbox should be able to help you with that.
If you have a time-sensitive question (e.g. academic assignment due), please direct any questions to your professor, teaching assistant, or a classmate. Like most contributors to the File Exchange community, I am not a Mathworks employee and have other responsibilities that I must attend to. I cannot guarantee that I will have the chance to check this page on a regular basis to answer your questions.
Some resources that can help you with any problems that arise while using the toolbox include:
- Genetic Algorithm Toolbox documentation (http://www.mathworks.com/help/gads/genetic-algorithm.html)
- The books, academic paper, and Wikipedia article listed in the "bibliography" section of the file description
It is very sad that you have not replied my query till yet.Again I am facing another problem with your code which I am explaining.
I am getting the fitness function from a simulink file. The simulink file will run if the variables lie within lower bound and upper bound.But with your code sometimes the variables exceed the lower bound or upper bound so that the simulink file is not able to execute and it shows error.So please help me as soon as possible. Thanks.
I have to optimize 16 parameters. Out of which the first nine parameters are in the range of zero to one but the rest seven variables are in the range of one to four (only integers).So please help me to use your codings. Is your coding is useful for mixed integer constraints?Again is it useful for 16 variables?
Anticipating a quick reply.Thanking you.
You should format your code like this,
vout = indicators([hi,lo,cl],'kdj',k,d)
vout = output vector
hi = high prices
lo = low prices
cl = closing prices
k = number of periods for %K
d = number of periods for %D
In order to extract fpctk, fpctd, and jline, please use the following code:
fpctk = vout(:,1);
fpctd = vout(:,2);
jline = vout(:,3);
1. All inputs must be vertically oriented
2. All outputs are returned vertically oriented
3. This code is intended to be used for hundreds or thousands of points of data. Normally you cannot use any of these functions for 1 single point. This function will require at least 1 more point of data for each of the hi, lo, and cl inputs than the maximum of the k or d inputs.