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

[amibroker] IIF's within IIF's



PureBytes Links

Trading Reference Links





What you see here is an attempt to create a scan that looks for 
the first "up day" following a series of as many as  twenty sequential 
days where the high of the day was less than the three day moving average 
of  the high.  To say it another way, this scan is looking 
for up to twenty mostly down days occurring, untill an up day finally appears 
(gasp).  I decided to look for the H>MA(H,3) in order to prevent the 
possibility of a single very small "up day" interfearing with the 
general idea of finding stocks that are in a severe free fall 
condition.  Needless to say, I tried several ways to get this scan to 
work as I wanted it to , but alas, all to no avail.  I then found that I 
could get it to actually run (with obviously no hits),  if I placed a zero 
to the left of the last comma in the IIF statement.  
Example>>IIf(ref(H<MA(H,3),PAST2,0).  What I am trying to 
ultimately achieve is an exploration for those conditions where a 
stock is in virtual freefall, and then I want to examine the 
subsequent behavior of the stock after the free fall ends. BTW, 
I sincerely appreciate all of the assistance provided by 
Amibroker users from around the world during my recent efforts to 
create my first exploration.  
In my first attempt to make this work, I had placed  "BUY" 
in place of the  zero to the right of the last comma in the IIF 
statement.   Example>>IIF(H>MA(H,3),PAST2,buy), but 
it would not work.  
I would really appreciate it if one of the many magnanimous 
Amibroker users  would be so kind as to create an exploration version of 
this freefall concept  that works,  I think I am capable 
of creating the necessary exploration report columns that I need to analyze 
the results of the exploration.  The rest of this email further 
elucidates what I did. 
The below PAST(n) statements were pasted into 
>>SETUP=O<C AND PAST1; and the resulting "SETUP=statement 
" is shown following  these commented PAST(n) statements.  
Further down in this email is shown the completed scan that actually 
ran and which obviously produced no buy candidates because of the zero that 
was placed to the right of the last comma in the IIF statement.   

Filter=C>1<FONT 
size=1> AND C<100<FONT 
size=1> AND MA<FONT 
size=1>(V,50<FONT 
size=1>)>100000<FONT 
size=1>;
//PAST1=IIf(Ref(H<MA(H,3),-1),PAST2,0) <FONT 
size=1>
//PAST2=IIf(Ref(H<MA(H,3),-2),PAST3,0) <FONT 
size=1>
//PAST3=IIf(Ref(H<MA(H,3),-3),PAST4,0) <FONT 
size=1>
//PAST4=IIf(Ref(H<MA(H,3),-4),PAST5,0) <FONT 
size=1>
//PAST5=IIf(Ref(H<MA(H,3),-5),PAST6,0) <FONT 
size=1>
//PAST6=IIf(Ref(H<MA(H,3),-6),PAST7,0) <FONT 
size=1>
//PAST7=IIf(Ref(H<MA(H,3),-7),PAST8,0) <FONT 
size=1>
//PAST8=IIf(Ref(H<MA(H,3),-8),PAST9,0) <FONT 
size=1>
//PAST9=IIf(Ref(H<MA(H,3),-9),PAST10,0) <FONT 
size=1>
//PAST10=IIf(Ref(H<MA(H,3),-10),PAST11,0) <FONT 
size=1>
//PAST11=IIf(Ref(H<MA(H,3),-11),PAST12,0) <FONT 
size=1>
//PAST12=IIf(Ref(H<MA(H,3),-12),PAST13,0) <FONT 
size=1>
//PAST13=IIf(Ref(H<MA(H,3),-13),PAST14,0) <FONT 
size=1>
//PAST14=IIf(Ref(H<MA(H,3),-14),PAST15,0) <FONT 
size=1>
//PAST15=IIf(Ref(H<MA(H,3),-15),PAST16,0) <FONT 
size=1>
//PAST16=IIf(Ref(H<MA(H,3),-16),PAST17,0) <FONT 
size=1>
//PAST17=IIf(Ref(H<MA(H,3),-17),PAST18,0) <FONT 
size=1>
//PAST18=IIf(Ref(H<MA(H,3),-18),PAST19,0) <FONT 
size=1>
//PAST19=IIf(Ref(H<MA(H,3),-19),PAST20,0) <FONT 
size=1>
//PAST20=IIf(Ref(H<MA(H,3),-20),1,0) 
The above 
PAST(n) statements were pasted into >>SETUP=O<C AND PAST1; with this 
result:





SETUP=O<C AND <FONT color=#0000ff 
size=1>IIf(Ref<FONT 
size=1>(H<MA<FONT 
size=1>(H,3<FONT 
size=1>),-1),<FONT 
color=#0000ff size=1>IIf(<FONT color=#0000ff 
size=1>Ref(H<<FONT color=#0000ff 
size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-2<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-3<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-4<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-5<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-6<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-7<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-8<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-9<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-10<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-11<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-12<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-13<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-14<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-15<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-16<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-17<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-18<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-19<FONT 
size=1>),IIf(<FONT 
color=#0000ff size=1>Ref(H<<FONT 
color=#0000ff size=1>MA(H,<FONT color=#ff00ff 
size=1>3),-<FONT 
size=1>20),<FONT color=#ff00ff 
size=1>1,0<FONT 
size=1>),0),<FONT 
color=#ff00ff size=1>0),<FONT color=#ff00ff 
size=1>0),0<FONT 
size=1>),0),<FONT 
color=#ff00ff size=1>0),<FONT color=#ff00ff 
size=1>0),0<FONT 
size=1>),0),<FONT 
color=#ff00ff size=1>0),<FONT color=#ff00ff 
size=1>0),0<FONT 
size=1>),0),<FONT 
color=#ff00ff size=1>0),<FONT color=#ff00ff 
size=1>0),0<FONT 
size=1>),0),<FONT 
color=#ff00ff size=1>0),<FONT color=#ff00ff 
size=1>0); <FONT 
color=#ff00ff size=1>

LASThigherhigh=<FONT color=#0000ff 
size=1>ValueWhen(<FONT color=#0000ff 
size=1>Cross(<FONT color=#0000ff 
size=1>MA(C,<FONT color=#ff00ff 
size=1>3),C),C,<FONT color=#ff00ff 
size=1>1);//this gives the 
approximate value of the close just as the line graph of close prices is 
crossing down through the 3day MA of close prices. This is the same thing as the 
STOCHK RED LINE passing down through the STOCHD BLUE LINE. This may not always 
be the exact high of the last pivot, but it is close enough for 
me.
LASThigherlow=ValueWhen<FONT 
size=1>(Cross<FONT 
size=1>(C,MA<FONT 
size=1>(C,3<FONT 
size=1>)),C,1<FONT 
size=1>);//I used 1 for the n-th most recent 
occurrence. There may also be an occurrance of this > Cross(C,MA(C,3)),C,1) 
happening on the day that the scan is being run. If so, then would the present 
occurrence of this Crossing be considered to be the n-th most recent occurrence 
rather than what I am assuming here. I will test it an find out.<FONT 
size=1>
PRIORhigherhigh=ValueWhen<FONT 
size=1>(Cross(<FONT 
color=#0000ff size=1>MA(C,<FONT color=#ff00ff 
size=1>3),C),C,<FONT color=#ff00ff 
size=1>2);//Same 
explanation as LASThigherhigh, but notice how this is now looking for the second 
most recent occurrence of a high pivot point.
PRIORhigherlow =ValueWhen<FONT 
size=1>(Cross<FONT 
size=1>(C,MA<FONT 
size=1>(C,3<FONT 
size=1>)),C,2<FONT 
size=1>);// Ditto the above 
explanation.
uptrendtest=LASThigherhigh>PRIORhigherhigh AND 
LASThigherlow>PRIORhigherlow;
Buy= Filter AND setup AND uptrendtest;
 
---Outgoing mail is certified Virus 
Free.Checked by AVG anti-virus system (<A 
href="">http://www.grisoft.com).Version: 6.0.520 / 
Virus Database: 318 - Release Date: 
9/21/2003






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.