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

[amibroker] Re: Period beteween two given dates in AFL



PureBytes Links

Trading Reference Links




Johan,
 
So you are defining the relationship between the 
three bars as a mathematical function of the element subscript, and the 
condition is identified as true when the numeric value of y equals 3 ? 

 
The first iteration through this is :  x = C [ 
i - k ]  >C [ i -k -1 ];
                                                 
x = C [ 3 - 0 ] > C [ 3 - 0 -1];
<FONT face=Arial 
size=2>                                                   
= C [ 3 ] > C [ 2 ]; 
<FONT face=Arial 
size=2>                                                y 
= 0 + 1 = 1
 
The second 
:                              
x = C [ 4 - 1] > C [ 4 - 1 - 1]
<FONT face=Arial 
size=2>                                                   = 
C [ 3 ] > C [ 2 ];
<FONT face=Arial 
size=2>                                                 
y = y + x = 1 + 1 = 2
 
The 
third:                                  
x = C [5 -2] > C [ 5 - 2 - 1] ;
<FONT face=Arial 
size=2>                                                  
= C [ 3 ] > C [ 2] ;
<FONT face=Arial 
size=2>                                                 
y = y + x = 2 + 1 = 3
 
and Cond [ i ] or Cond [ 3 ] == 3, and is 
true, except that it looks like only C [ 3 ] > C [ 2 ] has been 
tested.
 
Is this what you have performed here?  

 
I initially described the relationship as :  C 
[ 3 ] > C [ 2 ] and  C [ 2 ] > C [1 ] and C [ 1 ] 
> C [ 0 ] , which isn't exactly what I think you have done, but the specific 
price relationship wasn't the point of my question.  Thank you for 
your insight in this.  
 
If I my interpretation is correct, what 
would be changed to perform the above? 
 
Might this work?
 
for ( i=3; i<BarCount ; i++){k = 0 
;y = 0 ;
m = 0 ;
while( k <= 2 
){x=C[i-k-m]>C[i-k-n-1];y=y+x;k++;
m = m++;
Cond[i]=y==3;}}
First iteration :  x  = C 
[i-k-m]>C[i-k-m-1];
<FONT face=Arial 
size=2>                          = 
C [3-0-0] > C [3 -0 -0 -1]
<FONT face=Arial 
size=2>                          
= C [ 3 ] > C [ 2 ]
 
Second 
:         x = C [i-k-m] > 
C[i-k-n];
<FONT face=Arial 
size=2>                        = 
C [4 -1 -1] > C [ 4 - 1 - 1 -1]
<FONT face=Arial 
size=2>                        
= C [ 2 ] > C [ 1 ]
 
Third 
:            x = C 
[i-k-m] > C[i-k-n];
<FONT face=Arial 
size=2>                       = 
C [ 5 -2 -2] > C [ 5 - 2 -2 -1]
<FONT face=Arial 
size=2>                       
= C [ 1 ] > C [ 0 ]
 
If the initial relationship were : C [ 3 ] 
> C [ 2 ]  and C [ 2 ] > C [ 1 ] and C [ 1 ] < 
C [ 0 ] 
 
How would this be addressed?  Wouldn't the 
algorithm have to be split into 2 parts?
 
Glen<FONT face=Arial 
size=2>           

<FONT 
size=2>                      

<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  johsun 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, March 21, 2004 2:34 
PM
  Subject: [amibroker] Re: Help with 
  referencing previous prices
  OK, guess I didn't read your message properly.Does this 
  help you in any 
  way:for(i=3;i<BarCount;i++){k=0;y=0;while(k<=2){x=C[i-k]>C[i-k-1];y=y+x;k++;Cond[i]=y==3;}}Plot(C,"",colorBlack,styleCandle);Plot(Cond,"",colorBlue,styleHistogram|styleOwnScale);JohanSend 
  BUG REPORTS to <A 
  href="">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 Sponsor


  ADVERTISEMENT 












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.