Create Code frrom scratch

2 次查看(过去 30 天)
Hello all,
I am new with MATLAB and I try to implement the below code:
My inputs come from an ASCII file like:
Stock Date T(t) P(t) V(t) Market
ETE 04/01/2010 10170000 18.54 430 Big Cap
ETE 04/01/2010 10190000 18.90 890 Big Cap
The steps are:
  • Inputs:
T(i) = Time vector
P(i) = Price vector
V(i) = Volume vector
K = exogenously defined by the user ( to try different outcomes)
n = exogenously defined by the user ( to try different outcomes)
The steps are as follows:
  • 1. Sort by Time ascending T(i+1)> T(i)
  • 2. Expand the number of P(i) as many times as V(i), with i=1..._I_ So sum of new rows with Pi, will equal V(i).
  • 3. Re-index P(i) for i=1..._I_ as time ascending
  • 4. Initiate counter, t=0
  • 5. Add one unit to t.
  • 6. If I <tK,go to step 10 (insufficient data)
  • 7. For every i belonging [ (t-1)K +1, tK] classify each transaction (row) as 'BUY' or 'SELL' as
a. transaction is 'BUY' if Pi>Pt-1 or Pi=Pt-i and transaction (t-1) (previou row) was 'BUY'
b. otherwise the transaction is 'SELL'.
  • 8. Assign to variable KB(t) the number of variables classified as 'BUY' in step 7. Assign to variable KS the number of variables classified as 'SELL' in step 7, so K(t)=KB(t)+KS(t)
  • 9. Loop to step 6.
10. Set L=t-1 ( last bucket, not for use)
11. If L>=n Calculate
X= (SUM(t)abs(KS(t)-KB(t)) / n*K
% for t=L-n+1 until n=L
Many thanks for any helpfull comment in advance
Panos
  2 个评论
Walter Roberson
Walter Roberson 2011-9-14
Please indicate more clearly what your question is, what you would like to know?
Pap
Pap 2011-9-14
I cannot write a MATLAB code for steps 1-11
Any help?
Panos

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2011-9-14

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by