There might be something in the code, or it is just a case of today being a bad day for hammers.. I offer here essentially the same code but it now looks for ANY hammer in the last 100 days, and then checks for a downslope preceding it.. Admittedly this is more complicated to follow, but I just couldn't let it rest..
Note that the printout gives the date of the hammer found.
regards pete
exchange = nyse, amex, nasdaq; output = "hammer test.lst";
integer day, hamday, span, flag; float temp, last;
DaysRequired(200); DaysToLoad(199);
last :=0; span := -100; flag :=0;
for day = 0 to span step -1 do
if range(day)> 0 and open(day) => (low(day) + (range(day)*.5)) and close(day) => low(day) + (range(day)*.5) and open(day) != close(day) and // (open(day)= high(day OR close(day) = high (day)) // statement doesnt work MACD(day) <= 0 and close(day) < 20 and close(day) > 1 then hamday := day; // a hammer found flag :=1; day := span; endif; next day;
// look for preceding slope if flag >0 then for day = hamday to hamday-30 step -1 do temp := EMovAvg(day,26,cl); if temp < last then flag :=0; day := hamday-30; else last := temp; endif; // if temp local next day; endif;
if flag > 0 then println symbol,",",close(0),",",Date(hamday),",","Hammer",",",date(0); endif; // local
|