Richard Look at the help files for ValueWhen function.
At the bottom of the page are links to code that use the particular function I have not looked at details of Barry's code, but if you use my code (from below) that defines "ai", the there should be no problem Ara ----- Original Message ----- From: "richpach2" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, October 14, 2008 10:57 PM Subject: [amibroker] Re: AFL code question > Hello Ara and Barry, > > Thank you for your contribution but, please take into account my vast > two week experience in using AmiBroker and explain where do I > substitute my entry condition? In Barry's code "ai" array is not > initialized and gives an error. I assume that, this is not a complete > code. Can you please give me a simple working example which I can use > to understand the logic of the AFL code? > > Is there an example somewhere in the AFL library which shows using > valuwhen to identify specific bar break out? > > Regards > Richard > > > --- In [email protected], "richpach2" <[EMAIL PROTECTED]> wrote: >> >> Thank you for the explanation. I will try this code tomorrow. >> Especially, buysignal = valuewhen(.. statement. >> >> Regards >> Richard >> >> --- In [email protected], "Ara Kaloustian" <ara1@> wrote: >> > >> > You need to first make sure that you eliminate duplicate signals, so >> that >> > they will not affect the valu you save >> > >> > Try this: >> > bi = barindex(); >> > ai = bi - bi[0]; >> > intrade = (Buy,Sell); // intrade will become 1 at first signal >> and stay >> > at that value untill a sell signal arrives >> > buysignal = valuewhen(intrade and Ref(intrade,-1) ==0,ai,1); // >> this will >> > give you the arrayindex value of the buy signal. >> > >> > BuyHigh = high[buysignal]; >> > >> > ----- Original Message ----- >> > From: "richpach2" <richpach2@> >> > To: <[email protected]> >> > Sent: Monday, October 13, 2008 10:31 PM >> > Subject: [amibroker] AFL code question >> > >> > >> > > Hello AB Users, >> > > >> > > Can someone explain please, how do I reference a selected value > of the >> > > signal bar? >> > > For instance if signal bar is when signal=cross( close, > ema(close,9)) >> > > then, how do I store "High" of the signal bar for the future use > so, I >> > > can check if C>"Signal Bar High" occurred in the following bars? >> > > >> > > I looked at BarSince, VarSet, ValueWhen and SelectedValue but, I > am a >> > > little confused and unsure which one should I use. >> > > >> > > Any help or comment will be appreciated. >> > > >> > > Regards >> > > Richard >> > > >> > > >> > > ------------------------------------ >> > > >> > > **** IMPORTANT **** >> > > This group is for the discussion between users only. >> > > This is *NOT* technical support channel. >> > > >> > > ********************* >> > > TO GET TECHNICAL 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 >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > >> > > > > ------------------------------------ > > **** IMPORTANT **** > This group is for the discussion between users only. > This is *NOT* technical support channel. > > ********************* > TO GET TECHNICAL 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 > > >
