PureBytes Links
Trading Reference Links
|
hello Dimitris,
DIMITRIS TSOKAKIS wrote:
> Well, I see now, you want a superArray A with elements a0=H, a1=L,
> a2=C, a3=O etc.
> [I don't write a[0] because it has already another AFL meaning]
> Select say ^NDX, Run for all quotations the
> for(i=0;i<4;i++)
> {
> x=IIf(i==0,H,IIf(i==1,L,IIf(i==2,C,O)));
> AddToComposite(x,"~"+WriteVal(i,1.0),"C");
> Buy=0;
> }
> and then, in your IB paste the
>
> x="";g=0;
> for(i=0;i<4;i++)
> {
> x="~"+WriteVal(i,1.0);
> g=Foreign(x,"C");
> Plot(g,"a"+WriteVal(i,1.0),1,1);
> }
> All your ai will be there.
> May I ask the use of this procedure ?
> Dimitris Tsokakis
probably the code I'd provided caused this embarasment:
function fArrayInArray() {
local arrA, arrB, arrC; //1
for(i=0;i<BarCount;i++) arrA[i] = Close[i]; //2
for(i=0;i<BarCount;i++) arrB[i] = High[i]; //3
arrC[0] = arrA; //4
arrC[1] = arrB; //5
return arrC; //6
}
arrD = fArrayInArray();
this code was just for exemplification purposes. I created it just to
express what I mean from the point of view of AFL programming, and it is
not connected with any market strategy or whatsoever. I wanted to
emphasize that looping within lines two and three is their important
part but the body of each loop contains something different. in fact it
would be sufficient to write:
arrA = Close; //2
arrB = High; //3
without looping. the crucial part is creating another array (here: arrC)
that has only two elements. but these two elements are also arrays
(here: arrA=Close and arrB=High). I wanted to write a function that
would return such a hybrid so that later I could write:
Plot(arrD[0], "", colorRed);
which would plot Close array in this case.
Tomasz pointed out that in native AFL it is not possible. my attempt to
do this was because there are programming languages in which such a
structure is possible.
the real problem I wanted to solve was the workaround for AB4.40 to plot
daily moving averages on intraday charts. it is solved now. then I
started to think if it would be possible to create multidimensional
array in order to incorporate convex and concave idea you presented here
some time ago and which I liked very much.
The real function I wanted to write would accept intraday Close array,
compute daily moving average array, compute convex/concave stuff for the
latter, evaluate Color array and return hybrid of these arrays as one
array (properly distributed through intra bars) so that I could write:
Plot(arrD[0], "daily MA", arrD[1]);
which would plot daily moving average arrD[0] with color described in
arrD[1].
but it is impossible with native AFL. well, I don't know AFL very much.
I play with it, I have fun and learn sometimes by trying to figure out
its possibilities comparing to other programming languages. it was just
out of couriosity..
best regards,
BM
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
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 http://docs.yahoo.com/info/terms/
|