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

Re: [amibroker] Re: Conditional include



PureBytes Links

Trading Reference Links

as they are arrays you will need to use identifiers and for loop to
see other than the last value
for(i=1;i<barcount;i++)
{
if (  newBuy[i] OR newSell[i] )


}


-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


On 9/7/05, Terry <MagicTH@xxxxxxxxxxx> wrote:
> Fred,
> 
> Thanks for replying. That's what I thought (actual last bar as changed
> by newly received RT data).
> 
> I use it to determine each trade, which in this system, influences the
> following trade. The module in question computes five years of trade
> statistics so I can see which, of many trade conditions, is producing
> winning or losing trades, by how much and how often these rules occur.
> This is then used to adjust PositionSize for the next trade.
> --
> Terry
> 
> | -----Original Message-----
> | From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
> | Behalf Of Fred
> | Sent: Tuesday, September 06, 2005 11:18
> | To: amibroker@xxxxxxxxxxxxxxx
> | Subject: [amibroker] Re: Conditional include
> |
> | Currently executing bar ?! ...
> |
> | It's the LAST BAR ... which will change as the system sees new
> | data.  I thought you were wanting to use it this manner i.e. on a go
> | forward basis ... Is that correct or are you wanting to use it in
> | some other way as well ?
> |
> | --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> | > Of course on the {}. I didn't not think about the multiple lines of
> | > code. That explains another error.
> | >
> | >
> | >
> | > One question: does LastValue() represent the LastValue as
> | determined by
> | > the currently executing bar or is LastValue the very last value of
> | the
> | > array, thus giving the same result every time?
> | >
> | >
> | >
> | > I guess I can easily test this myself!
> | >
> | > --
> | >
> | > Terry
> | >
> | > -----Original Message-----
> | > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
> | On
> | > Behalf Of Tomasz Janeczko
> | > Sent: Tuesday, September 06, 2005 09:56
> | > To: amibroker@xxxxxxxxxxxxxxx
> | > Subject: Re: [amibroker] Conditional include
> | >
> | >
> | >
> | > Hello,
> | >
> | >
> | >
> | > First, you have to use BRACES, since #include simply "pastes" code
> | from
> | > external file in the place when
> | >
> | > it is used, so you end up with MULTIPLE lines (so they have to be
> | > enclosed in braces.
> | >
> | >
> | >
> | > Second thing is that your newBuy and newSell are ARRAYS and can
> | not be
> | > used in "if" condition
> | >
> | > See MOST COMMON MISTAKES:
> | > http://www.amibroker.com/guide/a_mistakes.html
> | >
> | >
> | >
> | >
> | >
> | > So corrected code would look as follows:
> | >
> | >
> | >
> | >  if ( LastValue( newBuy OR newSell ) )
> | >
> | >  {
> | >
> | >         #include <W_Xfactor.afl>
> | >
> | >  }
> | >
> | >  else
> | >
> | >         tradeLevel = trange = 1;
> | >
> | >
> | >
> | >
> | >
> | > However please note that this operates on lastvalue only, not on
> | > bar-by-bar basis.
> | >
> | >
> | >
> | > Please read Understanding AFL
> | >
> | > http://www.amibroker.com/guide/h_understandafl.html
> | >
> | >
> | >
> | > to learn how AmiBroker processes array statements.
> | >
> | >
> | >
> | > If you need bar-by-bar execution you need to write a LOOP.
> | >
> | >
> | > Best regards,
> | > Tomasz Janeczko
> | > amibroker.com
> | >
> | > ----- Original Message -----
> | >
> | > From: Terry <mailto:MagicTH@x...>
> | >
> | > To: amibroker@xxxxxxxxxxxxxxx
> | >
> | > Sent: Tuesday, September 06, 2005 4:47 PM
> | >
> | > Subject: [amibroker] Conditional include
> | >
> | >
> | >
> | > I would like to conditionally load and execute an Include file
> | only on
> | > days when certain conditions are True. I do this with ParamToggle
> | all
> | > the time since ParamToggle creates a numeric or Boolean condition.
> | Now I
> | > want to do it only on days when I have a Buy or Sell condition
> | which is
> | > in an array and Amibroker complains that array is not allowed in
> | an if()
> | > statement. IIf is not acceptable since it is just an assignment
> | > statement. I don't want to build a loop since the include file uses
> | > arrays.
> | >
> | >
> | >
> | > Here's the code. Any ideas?
> | >
> | >
> | >
> | >
> | >
> | >     if (newBuy OR newSell)
> | >
> | >         #include <W_Xfactor.afl>
> | >
> | >     else
> | >
> | >         tradeLevel = trange = 1;
> | >
> | >
> | >
> | > Error 6. Condition in IF, WHITEL, FOR statements ahs to be Numeric
> | or
> | > Boolean type. You can not use array here, please use [] (array
> | subscript
> | > operator) to access array elements.
> | >
> | > --
> | >
> | > Terry
> | >
> | >
> | >
> | >
> | >
> | > 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 other support material please check also:
> | > http://www.amibroker.com/support.html
> | >
> | >


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 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/

<*> 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/