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

[amibroker] Re: basic question about referencing bars



PureBytes Links

Trading Reference Links

i figured it out.  i had to make a FOR statement and then use

if (result [i] > .5)

after going through the manual again it made perfect sense, as you said.

"result" is an array therefore i needed to loop through each element
of the array to check if it met the IF condition.

i'm still not used to this array programming language, but it's slowly
making sense.

thanks a lot, i really appreciate it!!


--- In amibroker@xxxxxxxxxxxxxxx, Andrew Senft <senft@xxx> wrote:
>
> I think this will work:
> 
> Filter = Open > 40 AND Open < 60 AND result == 1;
> 
> bigitop wrote:
> >
> > i read the user guide thouroughly but it seems im missing something.
> > i had tried "if(result == 1)" (with the equality operator) but it
> > gives me the same error as in the beginning:
> >
> > variableX = variableY / abs(variableZ);
> > result = IIf (variableX > .5, 1, 0);
> >
> > if(result == 1){
> > Filter = Open > 40 & Open < 60;
> > }
> >
> > it is still seeing "result" as an array instead of as a number!
> >
> > "Condition in IF, WHILE, FOR statements has to be numeric or boolean
> > type. You cannot use an array here, please use [] (array subscript
> > operator) to access array elements"
> >
> > --- In amibroker@xxxxxxxxxxxxxxx
<mailto:amibroker%40yahoogroups.com>, 
> > "sidhartha70" <sidhartha70@> wrote:
> > >
> > > You need to use == instead of =...
> > >
> > > i.e. change the line,
> > >
> > > if(result = 1){
> > >
> > > to,
> > >
> > > if(result == 1){
> > >
> > > '==' checks equality... '=' assigns a value...
> > >
> > > I would recommend a good read of the AFL user guide... then all this
> > > will be obvious.
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx 
> > <mailto:amibroker%40yahoogroups.com>, "bigitop" <doctormuniz@> wrote:
> > > >
> > > > thanks for bearing with me. ok i'm making some progress but
still got
> > > > new setbacks.
> > > >
> > > > variableX = variableY / abs(variableZ);
> > > > result = IIf (variableX > .5, 1, 0);
> > > >
> > > > if(result = 1){
> > > > Filter = Open > 40 & Open < 60;
> > > > }
> > > >
> > > > the problem now is that "result" is evaluating to true (1)
even when
> > > > "variableX" is in reality less < .5
> > > >
> > > > therefore i'm getting all tickers in the 40-60 Open range. I
only want
> > > > to get the tickers where "variableX" is more > .5
> > > >
> > > > does it make sense?
> > > >
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx 
> > <mailto:amibroker%40yahoogroups.com>, Andrew Senft <senft@> wrote:
> > > > >
> > > > > Use IIF for arrays
> > > > >
> > > > > bigitop wrote:
> > > > > >
> > > > > >
> > > > > > thanks!! Ref() worked perfectly.
> > > > > >
> > > > > > can you please help me with one more thing
> > > > > >
> > > > > > i have a variable:
> > > > > >
> > > > > > variableX = variableY / abs(variableZ);
> > > > > >
> > > > > > i'm trying to use inside an if statement like this:
> > > > > >
> > > > > > if (variableX > .5)
> > > > > >
> > > > > > but it gives me the following error:
> > > > > >
> > > > > > "Condition in IF, WHILE, FOR statements has to be numeric or
> > boolean
> > > > > > type. You cannot use an array here, please use [] (array
subscript
> > > > > > operator) to access array elements"
> > > > > >
> > > > > > i tried referencing it as variableX[0] but it doesnt work. how
> > do i
> > > > > > know what's inside an array so that i can refer to it??
> > > > > >
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx 
> > <mailto:amibroker%40yahoogroups.com>
> > > > <mailto:amibroker%40yahoogroups.com>,
> > > > > > "sidhartha70" <sidhartha70@> wrote:
> > > > > > >
> > > > > > > Use the Ref() function...
> > > > > > >
> > > > > > > --- In amibroker@xxxxxxxxxxxxxxx 
> > <mailto:amibroker%40yahoogroups.com>
> > > > > > <mailto:amibroker%40yahoogroups.com>, "bigitop" <doctormuniz@>
> > > wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > > hi, im learning AFL and need some basic help.
> > > > > > > >
> > > > > > > > while i'm running a script how can i reference previous
> > bars and
> > > > > > > > forward bars?
> > > > > > > >
> > > > > > > > in other words, how do i get OCHLV info from a bar(s)
that are
> > > > back in
> > > > > > > > time and forward in time from the current array for
the same
> > > > symbol?
> > > > > > > >
> > > > > > > > I guess it would be something like: TimeFrameSet(
currentBar
> > > - 1 )
> > > > > > > >
> > > > > > > > is this possible with AB?
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > ----------------------------------------------------------
> > > > > >
> > > > > >
> > > > > > No virus found in this incoming message.
> > > > > > Checked by AVG - http://www.avg.com <http://www.avg.com>
> > > > > > Version: 8.0.176 / Virus Database: 270.11.3/1967 - Release
Date:
> > > > 2/23/2009 7:17 AM
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> > 
> >
------------------------------------------------------------------------
> >
> >
> > No virus found in this incoming message.
> > Checked by AVG - http://www.avg.com 
> > Version: 8.0.176 / Virus Database: 270.11.3/1967 - Release Date:
2/23/2009 7:17 AM
> >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/