I have on occasion got it to work but just don't feel it is reliable so haven't used. Maybe others can give us some input.
Dick H. --- In [email protected], "Herman" <[EMAIL PROTECTED]> wrote: > > Thank you for the nice code Dick, > > am testing your formula now... just out of curiosity, did you ever get the > AB build-in ADLine to work? > > herman > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Behalf Of areehoi > Sent: January 4, 2007 2:27 PM > To: [email protected] > Subject: [amibroker] Re: Need help with ADLine > > > > Herman, > Try this and let me know how it works. > > Dick H. > > _SECTION_BEGIN("A_D_NewHi_NewLo_Line"); > // Breadth of NDX100 > // Develops 4 composites that can be plotted or manipulated as you wish > // How to Run > // 1) Build a watchlist of NDX100 stocks > // 2) Select an issue with a long history in the current ticker window > // 3) Set APPLY TO to use filter NDX100 > // 4) Set RANGE to one bar... 1 n last quotations > // 5) Press SCAN > > //===================6 Weeks New > NewLows================================== > > AddToComposite(IIf(C > HHV(Ref(C, -1), 30), 1, > 0), "~NDXNewHi", "X"); > > AddToComposite(IIf(C < LLV(Ref(C, -1), 30), 1, > 0), "~NDXNewLo", "X"); > > NewHigh=Foreign("~NDXNewHi","X"); > NewLow = Foreign("~NDXNewLo","X"); > > > Opt_H_L=Optimize("Opt_H_L",43,20,50,1); > Opt_A_D=Optimize("Opt_A_D",12,10,30,1); > > //Opt_H_L=30; > //Opt_A_D=5; > > DIFF_H_L = NewHigh-NewLow; > MADiff_H_L=MA(Diff_H_L,Opt_H_L); > Plot(NewHigh,"NewHigh",colorGreen,styleLine); > Plot(NewLow,"NewLow",colorRed,styleLine); > Plot(MADiff_H_L,"MADiff_H_L",colorPlum,styleLine); > > MA_H_L=Ref(MADiff_H_L,0); > MA_H_L1=Ref(MADiff_H_L,-1); > MA_H_L3=Ref(MADiff_H_L,-3); > MA_H_L4=Ref(MADiff_H_L,-5); > Rising_H_L=MA_H_L>MA_H_L1 AND MA_H_L>MA_H_L3 AND MA_H_L>MA_H_L4 ; > > //===================Advance/Decline Issues > > AddToComposite(IIf(C - Ref(C, -1) > 0, 1, > 0), "~NdxAdv", "X" ); > > AddToComposite(IIf(Ref(C, -1) - C > 0, 1, > 0), "~NdxDec", "X" ); > > Adv=Foreign("~NdxAdv","X"); > Dec = Foreign("~NdxDec","X"); > > DIFF_A_D = Adv-Dec; > MADiff_A_D=MA(Diff_A_D,Opt_A_D); > Plot(Adv,"Adv",colorBlack,styleLine); > Plot(Dec,"Dec",colorBrown,styleLine); > Plot(MADiff_A_D,"MADiff_A_D",colorBrown,styleLine); > > MA_A_D=Ref(MADiff_A_D,0); > MA_A_D1=Ref(MADiff_A_D,-1); > MA_A_D3=Ref(MADiff_A_D,-3); > MA_A_D4=Ref(MADiff_A_D,-5); > Rising_A_D=MA_A_D>MA_A_D1 AND MA_A_D>MA_A_D3 AND MA_A_D>MA_A_D4; > > // >>>>>>>>>>>>>>>>>>>>> for Your indicator builder > > // use for long fund > Buy=Cover=Rising_A_D==True AND Rising_H_L==True; > Sell=Short= Rising_A_D==False AND Rising_H_L==False; > > // use for short funds > //Buy=Cover =Rising_H_L==False;// AND Rising_A_D==False ; > //Sell=Short =Rising_H_L==True;// AND Rising_A_D==True; > > Buy=ExRem(Buy,Sell); > Sell=ExRem(Sell,Buy); > //PlotShapes( shapeUpArrow * Buy + shapeDownArrow * Sell, IIf (Buy, > colorGreen, colorRed)); > Bu=Ref(Buy,-1); > Se=Ref(Sell,-1); > PlotShapes( shapeUpArrow * Bu + shapeDownArrow * Se, IIf (Bu, > colorBlue, colorBlue)); > > // Apply Stops > //OptStop=Optimize("OptStop",5,1,15,1); > //OptStop=9; > //ApplyStop( stopTypeNBar, stopModeBars, OptStop ); > > change = IIf( BarsSince(Bu)<BarsSince(Se), (C/ValueWhen(Bu,C)-1)*100, > (C/ValueWhen(Se,C)-1)*100 ); > > Close5= Ref(C,5); > Close10=Ref(C,10); > Fut5=((Close5/C)-1)*100; > Fut10=((Close10/C)-1)*100; > > //Buy=0; > Filter=1; > NDX=Foreign("^NDX","Close",1); > Cor_A_D=Correlation(NDX,Diff_A_D,250); > Cor_H_L=Correlation(NDX,Diff_H_L,250); > MaCor_A_D=Correlation(NDX,MADiff_A_D,250); > MaCor_H_L=Correlation(NDX,MADiff_H_L,250); > > > AddColumn(C,"Close",1.2); > AddColumn(Rising_A_D,"A_D",1.2); > AddColumn(Rising_H_L,"H_L",1.2); > AddColumn(Fut5,"Fut5",1.2); > AddColumn(Fut10,"Fut10",1.2); > AddColumn(Cor_A_D,"Cor_A_D",1.2); > AddColumn(MaCor_A_D,"MaCor_A_D",1.2); > > AddColumn(Cor_H_L,"Cor_H_L",1.2); > AddColumn(MaCor_H_L,"MaCor_H_L",1.2); > > "A_D_NewHi_NewLo_Line in Rut"; > " "; > "Advancing " +WriteVal(Adv,1.0); > "Declining " +WriteVal(Dec,1.0); > "Brown line is "+WriteVal(Opt_A_D,1.0)+ " day moving Avg"; > " "; > "New Highs " +WriteVal(NewHigh,1.0); > "New Lows " +WriteVal(NewLow,1.0); > "Yellow line is "+WriteVal(Opt_H_L,1.0)+ " day moving Avg"; > " "; > "The Brown Line is currently " + WriteVal( MADiff_A_D,1.1 ) + " and " > +WriteIf( rising_A_D,"rising", "falling."); > " "; > "The Yellow Line is currently " + WriteVal( MADiff_H_L,1.1 ) + " and " > +WriteIf( rising_H_L,"rising", "falling."); > " "; > "Precentage change since last signal is " + > WriteVal( change,.1); > > > > _SECTION_END(); > > > - In [email protected], "Herman" <psytek@> wrote: > > > > Blankhello, > > > > I can't figure out how to create ADLines for the NASDAQ N100 (eSig > data), > > and yes, to pre-empt the usual reply: I did search the lists and > help (btw, > > it seems i am not the only own who has problems) but I still can't > get it to > > work. > > > > Of course i can use composites but this seems a nice feature. > > > > Many thanks for any help you can give, > > > > herman > > > > > > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > > Yahoo! Groups Links >
