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

RE: [amibroker] Boolean question



PureBytes Links

Trading Reference Links










Cs

I think you need to have something to pass out of the loop
for the plot to work, or have the plot within the loop. The code is looking for
what you are wanting to do with the variables within the loop.

Remember that with script, from which the loops originate
you have to pass out the resultant arrays or values back to the AFL for further
processing. Sorry if my terminology or logic is wrong it is just the way I can
understand the process of coding.

If you place the plot within the loop you will get a series
of 20 horizontal lines  for A1

<font size=2 color=black
face="Courier New">T1=<span
lang=EN-AU >20<font
color=black face="Courier New">;

<font size=2 color=black
face="Courier New">Z1=<span
lang=EN-AU >BarCount<font
color=black face="Courier New"> > T1;

<font size=2 color=tan
face="Courier New">if<span
lang=EN-AU >(Z1)

<font size=2 color=tan
face="Courier New">for<span
lang=EN-AU > (i=<font
color=fuchsia face="Courier New">0<span
lang=EN-AU >;i<T1;i++)

<font size=2 color=black
face="Courier New">     {

<font size=2 color=black
face="Courier New">     A1=i ;

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >(A1,<font
color=darkred face="Courier New">"test"<font color=black
face="Courier New">,<span
lang=EN-AU >3<font
color=black face="Courier New">,<span
lang=EN-AU >1<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New"> 

<span
lang=EN-AU >    
}

 



<font size=3 color=teal
face="Times New Roman">Cheers,
Graham

<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/ASXShareTrading

<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/FMSAustralia



<span
>-----Original Message-----
From: CS
[mailto:res1wgwl@xxxxxxxxxxx] 
Sent: Tuesday, 27 May 2003 4:29 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Boolean
question

<font size=2
face="Times New Roman"> 



<span
>Graham,





<span
>Evidently, I can't see why what was
once a Boolean is no longer a Boolean. I am trying to find a conditional
variable that IF likes.





<span
>The whole point of this exercise is
to start a loop within FOR after a certain number of bars have
passed from the beginning of the data.





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman"> 





<span
>This works:





<font size=2
color=blue face=Tahoma>T1=20;<span
>
Z1=True;
if(Z1)
for
(i=0;i<T1;i++)
    
{
    
A1=i ;
    
}





<font size=2
color=blue face=Tahoma>Plot(A1,"test",3,1);





<font size=2
face="Times New Roman"> 





<span
>Problem is, I need Z1 to be false <font
face=Tahoma>until
20 bars have passed, and Z1 of course, gives no choice in this example.





<font
size=2 color=blue face=Tahoma>









<font size=2 color=black
face=Tahoma>This
doesn't because of the "array error" in <font
color=red face=Tahoma>IF(Z1)<font
color=black face=Tahoma> ,
although there is only one possible response per bar, and <font
color=red face=Tahoma>Z1<font
color=black face=Tahoma> sure
looks Boolean to me since it is either true or false.





<font size=2
color=red face=Tahoma>T1=20;<span
>
Z1=BarIndex()
> T1;
if(Z1)
for
(i=0;i<T1;i++)
    
{
    
A1=i ;
    
}





<font size=2
color=red face=Tahoma>Plot(A1,"test",3,1);

<font
size=2 color=red face=Tahoma>









<font size=2
color=red face=Tahoma>Z1 = ( (BarIndex() > T1) == true );<font
color=black face=Tahoma> 
doesn't work, and of course <font color=red
face=Tahoma>Z1=IIF(BarIndex() >
T1,TRUE,FALSE); <span
>doesn't work.





<font size=2 color=blue
face=Tahoma> 





<font size=2 color=blue
face=Tahoma> 





<font size=2 color=black
face=Tahoma>Possibly,
I should write the loop as a function and access the function after the
necessary number of bars have passed by:





<font size=2 color=blue
face=Tahoma> 





<font size=2 color=black
face=Tahoma>Plot(
IIF( Z1, function(loop), NULL )<font
color=black face=Tahoma>,
"test", Color, Line);





<font size=2 color=blue
face=Tahoma> 





<font size=2 color=black
face=Tahoma>Any
other ideas?





<font size=2 color=blue
face=Tahoma> 





<font size=2 color=black
face=Tahoma>Thanks,





<font size=2 color=black
face=Tahoma>-CS





<font size=2 color=blue
face=Tahoma> 







<span
>----- Original Message ----- 





<font
size=2 face=Arial>From: <a
href="" title="gkavanagh@xxxxxxxxxxxxx">Graham






<span
>To:<font
face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
face=Arial> Monday, May 26, 2003 6:15 AM





<span
>Subject:<font
face=Arial> RE: [amibroker] Boolean question





<font size=2
face="Times New Roman"> 



<span
>Z1 will be a 0 or 1 depending if the
condition is false or true

<font size=2
face="Times New Roman"> 



<font
size=3 color=teal face="Times New Roman">Cheers,
Graham

<font
size=2 color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/ASXShareTrading

<font
size=2 color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/FMSAustralia



<span
>-----Original Message-----
From: CS
[mailto:res1wgwl@xxxxxxxxxxx] 
Sent: Monday, 26 May 2003 7:41 PM
To: <a
href="">amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Boolean
question

<font size=2
face="Times New Roman"> 



<span
>In AFL:





<font size=2
face="Times New Roman"> 





<font size=2
face=Tahoma>T1=20;





<font size=2
face=Tahoma>Z1=BarIndex()>T1;





<span
>Does <font
face=Tahoma>Z1
contain a boolean response?





<font size=2
face="Times New Roman"> 





<span
>Anyone know how to convert <font
face=Tahoma>Z1 to
boolean?





<font size=2
face="Times New Roman"> 





<span
>Thanks,





<span
>-CS



 

<font size=2
face="Courier New">Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<span
>
Send 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


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.


<font size=2
face="Times New Roman"> 

<font size=2
face="Times New Roman">

Send BUG REPORTS to
bugs@xxxxxxxxxxxxx
Send 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


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.




<font size=2
face="Times New Roman">



Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<span
>
Send 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


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.











Yahoo! Groups Sponsor


  ADVERTISEMENT 









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.