[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Require Laymans Explanation.



PureBytes Links

Trading Reference Links



I am still having trouble understanding how AddToComposite is actualy
functioning in amibroker. I do understand how data is in
Arrays....
Im sorry to bug everyone with such petty issues, But I admit to total
incompetence in getting this worked out myself. I have read the Tutorial
on  ATC and the UserGuide on how AFL works......
Im not sure why my final composite does not hold the highest value of any
one ticker for each bar (day).
Here's the process:
1st up, I create an Empty composite. Ready for use with my
scan.
It is simply this:
Buy =
0;
// required by
scan mode
AddToComposite(0,"~MyIndex","V",3);
// Create 
Empty Composite
If the composte exists from a previous scan - I Delete it and
create a new one.
2nd, I Run my actual scan. I will break this into 3 segments -
Psudo code ,array progress and actual code.


Psudo:

Read the Composite V array

See if Current V is greater than Composite V

    if it is, Then add the Difference between the two
- to the Composite V

        (ie
increase the Composite V to equal Current V)

    If it's not, Then add nothing to the
Composite.

Write the Composite V.

Go to next Ticker and repeat

        Pseudo
eg: (Just showing ONE bar for this example)
        V = 10,
F=4 


if 10 > 4 then  "Result" = (10
- 4)     True

        else
"Result" =
0                       False

So "Result" should = 6 in this example.

When we add "Result" to the Composite, The Composite should
= 10

ie 4 + 6 = 10.

Array Progress: (I will format as best I can)
Ticker                                  (Bars)
        1)
Vcomposite   =0      0       0       0       0       0
amp     2)
Volume       =4      8       3       2       6       1
        3)
Addto        =4      8       3       2       6       1

        4)
Vcomposite   =4      8       3       2       6       1
(now equals)
        1)
Vcomposite   =4      8       3       2       6       1
bhp     2)
Volume       =6      3       6       2       1       2
        3)
Addto        =2      0       3       0       0       1

        4)
Vcomposite   =6      8       6       2       6       2
(now equals)
Etc though all the tickers.
As you can see, The composite should end up with a latched high value for
each bar.
What I seem to get - Is as if on each change of ticker - The composite is
read in as "0" 
again. And the entire ticker volume is added each time. 
However Tomasz has indicated that the Composite is updated
immediatelly and is accessable
after the AddToComposite call. So reading the composite on the next
ticker should not return 0.
Actual Code: (Same as before)
// Store Highest Volume
for each day in Composite V.
// Scan Part:
Buy =
0;
// required by
scan mode
/* Use ATC as a "Highest Value" Static array */
F = 
Foreign(
"~MyIndex",
"V");
addTO =
IIf
(V > F,(V - F),
0);

AddToComposite(addTO,
"~MyIndex",
"V",3
);      
Could someone show me what part Im getting wrong. What is actualy
happening to the composite????
KR
        Michael.







Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.