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

[amibroker] Re: Finding trading range/horizontal channel, can it be done like this?



PureBytes Links

Trading Reference Links

Thanks again Wayne! I appreciate your input!

I have solved the problems I had. 
Filter=hChannel; worked, I guess if the variable is 1 or true then you
don't need the = at all.



--- In amibroker@xxxxxxxxxxxxxxx, "wlandry01" <wlandry01@xxx> wrote:
>
> Hi,
> 
> A couple of things occur to me:
> 
> 1.)  At one point the code defines "HChannel" as "False".  Later the
> terminology used is "hChannel".  Should those be the same?
> 
> 2.)  Also, the statement, "Filter=hChannel=True;" probably should read
> "Filter=hChannel==True;".  I believe the current wording sets "Filter"
> to "True" but it appears that you want to set the "Filter" to "True"
> only when "hChannel" is "True".
> 
> Hope this helps.
> 
> 
> Wayne
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "carlacash26" <carlacash26@> wrote:
> >
> > OK, here is what I have come up with. It will perform an exploration, 
> > but it will just 
> > list all the stock, not filter out the ones that are not meeting my 
> > criteria.
> > 
> > Background; I search for the 3 highest high value for past 10 days, 
> > 10-20 days and 20-30 days.
> > Then I want to find the smallest of these values and compare it to 
> > the highest high value of them all,
> > if they don't deviate by more than 2%, the stock has a resistance 
> > level at that point.
> > Same thing with the lowest low values, which will find me the support 
> > level.
> > 
> > The problem I am facing now is that there is something wrong with 
> > finding the smallest of
> > the Highest high values. The HHmin is just set as "1.00" and not as 
> > the value of the smallest of 
> > the 3 HHVs.
> > 
> > I hope someone can help me with this. I think I'm close now.
> > 
> > 
> > 
> > 
> > 
> > /*****************************
> > Find stocks in a trading range
> > ******************************/
> > 
> > // First find the highest high values, And lowest low values for the
> > //3 periods; 10 days ago, 10-20 days ago, and 20-30 days ago
> > 
> > HHA=Ref(HHV(H,10),-1); //HHV of 10 days ago (for example 33)
> > HHB=Ref(HHV(H,10),-10); //HHV of 10 to 20 ago (for example 32)
> > HHC=Ref(HHV(H,10),-20); //HHV of 20 to 30 days ago (for example 34)
> > 
> > LLA=Ref(LLV(L,10),-1); //LLV of 10 days ago (for example 33)
> > LLB=Ref(LLV(L,10),-10); //LLV of 10 to 20 ago (for example 32)
> > LLC=Ref(LLV(L,10),-20); //LLV of 20 to 30 days ago (for example 34)
> > 
> > 
> > 
> > //Then find the smallest value of the 3 HHVs, and the largest value 
> > of the LLVs
> > 
> > HHmin = IIf((HHA < HHB=True) AND (HHA < HHC=True), HHA, HHB);
> > HHmin = IIf((HHB < HHA=True) AND (HHB < HHC=True), HHB, HHB);
> > HHmin = IIf((HHC < HHB=True) AND (HHC < HHA=True), HHC, HHB);
> > 
> > LLmax = IIf((LLA > LLB=True) AND (LLA > LLC=True), LLA, LLA);
> > LLmax = IIf((LLB > LLA=True) AND (LLB > LLC=True), LLB, LLB);
> > LLmax = IIf((LLC > LLB=True) AND (LLC > LLA=True), LLC, LLB);
> > 
> > 
> > 
> > //Then caluculate the average of these HHVs and LLVs 
> > //NOTE: this is not needed for the time being
> > 
> > HHavg=((HHA+HHB+HHC)/3);//(for example = 33)
> > LLavg=((LLA+LLB+LLC)/3); //(for example =28)
> > 
> > 
> > 
> > //Then check to see if the min and max of the three HHVs and
> > //LLVs are not deviating too much, I chose 5% as example
> > //of maximum deviation.
> > 
> > HChannel=False;
> > minHHrange=(HHV(H,30) * 0.95);  //set the min and max values
> > maxHHrange=(HHV(H,30) * 1.05);
> > minLLrange=(LLV(L,30) * 0.95);
> > maxLLrange=(LLV(L,30) * 1.05);
> > 
> > 
> > hChannelHHmin = IIf (HHmin > minHHrange, True, False);
> > hChannelHHmax = IIf (HHmin < maxHHrange, True, False);
> > hChannelLLmin = IIf (LLmax > minLLrange, True, False);
> > hChannelLLmax = IIf (LLmax < maxLLrange, True, False);
> > 
> > 
> > //Then sum up all of the criteria
> > hChannel = IIf (hChannelHHmin=True AND hChannelHHmax=True AND 
> > hChannelLLmin=True AND hChannelLLmax=True, True, False);
> > 
> > //And finally filter out the ones that don't meet the criteria
> > Filter=hChannel=True;
> > 
> > COLA= Close;
> > COLB= Ref(HHV(H,10),-1); 
> > COLC=HHB=Ref(HHV(H,10),-10);
> > COLD=Ref(HHV(H,10),-20);
> > COLE= HHmin;
> > 
> > AddColumn(Cola,"close");
> > AddColumn(Colb,"HHV-10");
> > AddColumn(Colc,"HHV-10-20");
> > AddColumn(Cold,"HHV-20-30");
> > AddColumn(Cole,"HHmin");
> > 
> > //END OF CODE
> >
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.31/676 - Release Date: 2/8/2007 3:04 PM