Stuart, thanks for your contribution. It Looks to me that this is not able for real live trading because the "reg2" value "res" (of the egcitest) is changing its history with every new datapoint. If for example the res value at Bar 8 is -.9 for bar 7 the res value might be +0.8 for bar 7 at bar 20. Do you know a solution for this issue?
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.
Thanks for the feedback Alejandro! I'm glad everything is working out for you.
At the moment I do not have access to Matlab in order to make this change but as soon as I do, I will add in your suggestion.
How to use the code on KDJ? Please,
Say, I have tick data(tick) and like to has KDJ(9,2,3). Thanks,
I did try, but get error.
>> [fpctk,fpctd,jline] = indicators([2500,2490,2495],'kdj',9,2);
??? Error using ==> indicators
Too many output arguments.