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

[amibroker] Re: AFL code question



PureBytes Links

Trading Reference Links

Sorry. I didn't copy all the code since the example already had the 
following which you need to add at the top of your code, at least 
above where ai is used:

bi = BarIndex();
ai = bi - bi[0];

In AFL all the variables have to be declared and assigned some 
initial value before they are used. Since ai is used inside a 
statement it needed to be declared first. The above code declares ai 
and assigns it to the value of bi - bi[0];

I used ExRem in my example but Ara said he used Flip instead. Play 
with both and see what differences there are. 

Barry

--- In amibroker@xxxxxxxxxxxxxxx, "richpach2" <richpach2@xxx> wrote:
>
> 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 amibroker@xxxxxxxxxxxxxxx, "richpach2" <richpach2@> wrote:
> >
> > Thank you for the explanation. I will try this code tomorrow.
> > Especially, buysignal = valuewhen(.. statement.
> > 
> > Regards
> > Richard
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "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: <amibroker@xxxxxxxxxxxxxxx>
> > > 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/