SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quotes Plus

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: Gary Lyben who wrote (8227)1/8/1999 6:02:00 PM
From: Alain Joaris  Read Replies (1) of 11149
 
Gary, and others ...

I am trying to write a scan which can tell me when a security has reached a certain level.
In the following scan I am trying to find when the close bar made a max and/or a min for a selected list of symbols.

// ---- WhenMinMax scan
Input = "SBP.lst";
Output = "WhenMaxMin.lst";
Integer d, e, mindate, maxdate;
Float maxbar, minbar;
for d = -20 to -2 step 1 do
if cci(d) < -100 and
cci(d) > -999999.00 and
cci(d) > cci(d-1) then
maxbar := max(0, d+2, cl); minbar := min(0, d+2, cl);
mindate := d; maxdate := d;
for e = d to 0 step 1 do
if close(d) >= maxbar then
maxdate := e;
e := 0;
endif;
if close(d) <= minbar then
mindate := e;
e := 0;
endif;
next e;
println symbol, ",", date(d), ",", d, ",", open(d+1):8:2, ",",
date(maxdate), ",", max(0,d+2,cl), ",", maxbar, ",",
max(0,d+2,cl)/open(d+1):5:2, ",", date(mindate), ",", minbar, ",",
min(0,d+2,cl), ",", min(0,d+2,cl)/open(d+1):5:2;
endif;
next d;
// --- end WhenMinMax scan

While running this, mindate and maxdate are never initialized with another value than d, so the conditions (close >= maxbar and close <= minbar) are never met, although the for ... next must come accross such a value. It seems impossible to store the result of a max/min statement and find out when this value was reached.

Does anyone know of a way to make this work with QP2 ?

Alain Joaris
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext