PureBytes Links
Trading Reference Links
|
I
still don't know exactly what you need but the following may give you some
ideas. You step through the entire price array one bar at a time and check
conditions one bar at a time, saving the one bar result as you go along. This
code doesn't do anything, just illustrate the use of
indices.
<FONT face=Arial color=#0000ff
size=2>
C0=CCI(<FONT
color=#ff00ff size=2>7);C1=<FONT color=#0000ff
size=2>CCI(12<FONT
size=2>);C2=CCI<FONT
size=2>(32<FONT
size=2>);BSC=0<FONT
size=2>; <FONT face="Courier New"
color=#008000 size=2>// this initializes the entire array<FONT
size=2>BSCC=0<FONT
size=2>;FullWidthBars=<FONT color=#0000ff
size=2>BarsSince(<FONT color=#0000ff
size=2>Cross(0<FONT
size=2>,C2));for<FONT
size=2> (i=1<FONT
face="Courier New" size=2>; i<BarCount;<FONT
size=2>i++){<FONT face="Courier New"
color=#008000 size=2>//<FONT color=#008000
size=2>FullWidthBars[i]
.... // not sure what you are doing ...<FONT color=#800000
size=2>if(C0<FONT face="Courier New"
size=2>[i]>C1<FONT face="Courier New"
size=2>[i] AND C0<FONT face="Courier New"
size=2>[i-1<FONT
face="Courier New" size=2>]<<FONT
face="Courier New" size=2> C1<FONT face="Courier New"
size=2>[i-1<FONT
face="Courier New" size=2>] AND BSC[<FONT
face="Courier New" size=2>i]==<FONT color=#ff00ff
size=2>0)
BSC[i<FONT
size=2>]=1<FONT
size=2>;if<FONT
size=2>(BSC[i<FONT
size=2>]>0 AND
C0[i]<FONT
size=2>>C2[i]
AND C<FONT
size=2>0[i-<FONT
face="Courier New" color=#ff00ff size=2>1<FONT face="Courier New"
size=2>] <
C2[i<FONT
size=2>-1<FONT face="Courier New"
size=2>])
BSCC[i<FONT
size=2>]=BSCC[i-<FONT
face="Courier New" color=#ff00ff size=2>1]+<FONT
color=#ff00ff size=2>1;<FONT
size=2>}
good
luck,
<FONT face=Arial color=#0000ff
size=2>herman.
-----Original
Message-----From: Robert Nemeth
[mailto:rjnemeth@xxxxxxxxx]Sent: Friday, March 19, 2004 9:19
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker]
Converting array to number
Thank you Ara and Herman for your response. Afterreading
your messages, I looked deeper into the codeand found an array wasn't zero
up to the point Iwanted. Yep, the code needed to be changed. I
couldnot figure out how to do it without a loop so I wroteone (below).
I cannot get it to run because I don'tknow how to convert the present
value of an array to anumber. The following gets an
error.C0=CCI(7);C1=CCI(12);C2=CCI(32);BSC[0]=0;BSCC[0]=0;FullWidthBars[0]=BarIndex()-BarsSince(Cross(0,C2));//errorherefor
(i=FullWidthBars[0];i>BarIndex();i++){if(C0>C1 AND
Ref(C0,-1)<Ref(C1,-1) AND
BSC[0]==0) BSC[0]=1;if
(BSC[0]>0 AND C0>C2 AND
Ref(C0,-1)<Ref(C2,-1))
BSCC[0]=BSCC[0]+1;}If I use "Selectedvalue", I get a constant
rather thanincrementing numbers for each bar. The documentationsays it
returns not the value at the current bar butthe value at a selected
time.This is my first attempt at writing pattern matchingcode. I
want a variable lookback period which istriggered by one event and then
narrowed by the firstoccurance of the second event following event 1.
ThenI count the occurrances of a third event.I just cannot get it
to work because of type mismatch.Help from anyone would be
appreciated.Robert--- Robert Nemeth <rjnemeth@xxxxxxxxx>
wrote:> Could someone tell me how to convert current array>
value to number? I think this is my problem with:>
>Sum(Cond1,HHV(BarsSince(Cond2)+1,BarsSince(Cond3)))<=1>
> The variable doesn't seem to be correct in the> Period>
field of "SUM" or "HHV". I tried "SelectedValue" but> it did not work
and probably is not designed to> function this way for a
backtest.> > Tnx> Robert > >
__________________________________> Do you Yahoo!?> Yahoo! Mail
- More reliable, more storage, less spam> <A
href="">http://mail.yahoo.com>
__________________________________Do you Yahoo!?Yahoo!
Finance Tax Center - File online. File on time.<A
href="">http://taxes.yahoo.com/filing.htmlSend
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
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
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|