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

Fixes for QP bull/bear scan



PureBytes Links

Trading Reference Links

There were some errors and omissions in my QP2 bull/bear scan, including a
misplaced "lo" in the "bullfear" formula. Here is a fixed scan:

//Bull/Bear Fear, by Walter T. Downs
//translated for QP2 by Brooke
//based on article in August 1998 issue of TASC
//n := 12 {Time periods};
//BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 + LLV(HIGH,n);
//CLOSE > BullFear
//BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 + LLV(LOW,n);
//CLOSE < BearFear

output = "bull.lst";
input="volvol.lst";
     
integer periods;   
float bullfear, bearfear, bullfprev, bearfprev;

periods:=11; 


bullfear:=(max(0,-periods,hi)-min(0,-periods,hi))/2 + min(0,-periods,hi);
bullfprev:=(max(-1,-(periods+1),hi)-min(-1,-(periods+1),hi))/2 + 
min(-1,-(periods+1),hi);

bearfear:=(max(0,-periods,lo)-min(0,-periods,lo))/2 + min(0,-periods,lo);
bearfprev:=(max(-1,-(periods+1),lo)-min(-1,-(periods+1),lo))/2 
+ min(-1,-(periods+1),lo);
     
     
if close(0)>bullfear then
if close(-1)<bullfprev then
println symbol,",", "Buy:  ", "Close: ", close(0):6:2,", ", "Change: ",
Close(0)-Close(-1):5:2, ", ", "Bullfear: ", bullfear;
endif; endif;

if close(0)<bearfear then
if close(-1)>bearfprev then
println symbol,",", "Sell: ", "Close: ", close(0):6:2,", ", "Change: ",
Close(0)-Close(-1):5:2, ", ", "Bearfear: ", bearfear;
endif; endif;