PureBytes Links
Trading Reference Links
|
Any help for this novice, regarding Ara's code example?
I get the following error and am not yet equipped to determine
the "why". THX in advance:
Ln: 11, Col: 25 : Error 9. Array subscript has to be a number
//Barry's example buy/sell conditions
fMA = MA(C, 4);
Buy = fMA > Ref(fMA, -1);
Sell = fMA < Ref(fMA, -1);
//Ara's code example
bi = BarIndex();
ai = bi - bi[0];
intrade = Flip(Buy,Sell); // intrade will become 1 at first signal
and stay at that value until 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];
--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>
> 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" <richpach2@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> 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 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
<*> 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/
|