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

[amibroker] stochCross lookback



PureBytes Links

Trading Reference Links




First of all,  thanks to  DT, and Andrew for 
responding to my recent post which I entitled IIF's within IIF's. Andrew 
referred to my efforts as nested IIF's.  I tested their recommendations, 
and the results of their suggestions were so good that it only 
increased my resolve to perfect my nested IIF's scan.  I finally got my 
nested IIF's scan to work as I wanted it to.  Now I am trying to 
add  PRECONDITIONS  to this  nested IIF scan which will 
eliminate many of the less desirable buy arrows.  
 
Nothing I have tried so far will work as I intended it to 
work.   I want to add two preconditions to this nested IIF  scan, 
either of which will help prevent the appearance of buy arrows when an 
unacceptable occurrence of  Cross(stochk(14),stochd(14)); happens. These 
two preconditions will greatly improve the accuracy of the  nested IIF 
 scan , and it will almost certainly improve any scan that also uses 
Cross(stochk(14),stochd(14));
 
PRECONDITION#1--When a stochCross is detected, I 
need code that will look back at the past (n) days, and 
which will be able to locate  the last 
Cross(stochk(14),stochd(14)); that occurred at least (n) days prior to the 
present Cross(stochk(14),stochd(14));   A properly coded 
version this PRECONDITION#1 code will simply ignore all of the 
Cross(stochk(14),stochd(14)); that happened less than (n) days prior 
to this present  Cross(stochk(14),stochd(14)) that has been 
 detected by the nested IIF scan;     Below is 
code that works in an improper way.  I first ran it alone so I could 
see the results of scanning with  this precondition alone.  When a buy 
arrow does appear, it is correctly placed at 10 days after a 
Cross(stochk(14),stochd(14));  occurred, and additional sequential 
 buy arrows also correctly appear up until the day just before another 
Cross(stochk(14),stochd(14)); happens.   Also, no buy arrows 
appear at all when TWO  sequential buy stoch 
Crosses  occur  closer than 10 days apart.  When I 
use   "<FONT 
size=1>Buy= Filter <FONT 
face="Courier New" size=1>AND <FONT 
size=1>MinDaysSinceX1 
AND <FONT face="Courier New" color=#0000ff 
size=1>Cross(<FONT 
face="Courier New" color=#0000ff size=1>StochK<FONT face="Courier New" 
size=1>(14<FONT 
face="Courier New" size=1>),<FONT face="Courier New" color=#0000ff 
size=1>StochD(<FONT 
face="Courier New" color=#ff00ff size=1>14<FONT face="Courier New" 
size=1>));" < This scan runs, but I get no results 
at all.
Below is what I tried for this 
first PRECONDITION#1.

 
Filter=C><FONT color=#ff00ff 
size=1>1 AND C<<FONT color=#ff00ff 
size=1>100 AND <FONT color=#0000ff 
size=1>MA(V,<FONT color=#ff00ff 
size=1>50)><FONT color=#ff00ff 
size=1>100000;
DaysSinceX1=<FONT color=#0000ff 
size=1>BarsSince( <FONT color=#0000ff 
size=1>Cross(<FONT color=#0000ff 
size=1>StochK(<FONT color=#ff00ff 
size=1>14),<FONT color=#0000ff 
size=1>StochD(<FONT color=#ff00ff 
size=1>14)));

MinDaysSinceX1=IIf<FONT 
size=1>(DaysSinceX1>=10<FONT 
size=1>,1,<FONT 
color=#ff00ff size=1>0);
Buy= Filter <FONT 
face="Courier New">AND MinDaysSinceX1;<FONT 
size=1> <<This scan works, but not in the way I need it 
to.
 
PRECONDITION#2-- This precondition needs 
to compare the PRECONDITION#1 value of stochD(14) which is 
the  PRESENT value of stochk(14)  which  occurred 
 during the PRESENT Cross(stochk(14),stochd(14));.  
This PRESENT value of  stochD(14) must be higher than the 
PRECONDITION#1 value of stochD(14) in order to be in compliance 
with  PRECONDITION#2.
I tried to run a simple version of PRECONDITION#2 without 
PRECONDITION#1 even being taken into consideration. 
Below, I have pasted  the only version of my 
efforts of coding PRECONDITION#2  that performed exactly as it was coded to 
do. The only problem is, I had to keep changing the coding in order to get it to 
produce any results at all. So the only version that ran <FONT 
face=Arial>exactly as the coding asked it to is NOT looking  for 
the necessary conditions that are required for compliance with 
PRECONDITION#2.  This incorrect version of 
PRECONDITION#2. requires that  the value of stochD(14) which 
accompanied the last (NOT THE PRESENT) Cross(stochk(14),stochd(14)) must be 
higher than thethat  stochD(14) value which accompanied  the 
   Cross(stochk(14),stochd(14));  <<this is the 
stochD value  that occurred JUST PRIOR to this last 
crossing.  This JUST PRIOR crossing is two crossings ago.  I need code 
which will identify the value of stochd(14) associated with the 
Cross(stochk(14),stochd(14)); which occurred JUST PRIOR to the PRESENT 
occurrence of Cross(stochk(14),stochD(14));.      As 
always, all suggestions will be greatly appreciated. Ron 
D 
Filter=C><FONT color=#ff00ff 
size=1>1 AND 
C<100 
AND MA<FONT 
size=1>(V,50<FONT 
size=1>)>100000;
ThisstochX<FONT face="Courier New" 
size=1>=ValueWhen<FONT 
size=1>(Cross(<FONT 
color=#0000ff size=1>StochK(<FONT color=#ff00ff 
size=1>14),<FONT color=#0000ff 
size=1>StochD(<FONT color=#ff00ff 
size=1>14)),<FONT color=#0000ff 
size=1>StochD(<FONT color=#ff00ff 
size=1>14),1<FONT 
size=1>);
LaststochX<FONT face="Courier New" 
size=1>=<FONT face="Courier New" color=#0000ff 
size=1>ValueWhen(<FONT 
face="Courier New" color=#0000ff size=1>Cross<FONT face="Courier New" 
size=1>(StochK<FONT 
face="Courier New" size=1>(<FONT face="Courier New" color=#ff00ff 
size=1>14),<FONT 
face="Courier New" color=#0000ff size=1>StochD<FONT face="Courier New" 
size=1>(14<FONT 
face="Courier New" size=1>)),<FONT face="Courier New" color=#0000ff 
size=1>StochD(<FONT 
face="Courier New" color=#ff00ff size=1>14<FONT face="Courier New" 
size=1>),2<FONT 
size=1>);
ThisXhigher<FONT face="Courier New" 
size=1>=ThisstochX > <FONT face="Courier New" 
size=1>LaststochX;
Buy= Filter  
AND 
ThisXhigher<FONT 
face="Courier New" size=1>;
 
---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/24/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.