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

Re: [amibroker] Re: Initializing Variables once at the start of the program



PureBytes Links

Trading Reference Links

Hi Fred, thanks for this... that is helpful.
 
WHat happens when I am intraday trading. I think this will be processed every TICK. Is that correct ?
 
I want to process my historical bars ONCE, then only process the bars I haven't processed - the real time bars.  SO, when I apply my indicator, it will start from bar 0, go to current bar, and then ONLY process new bars and new real time ticks from there - like Tradestation does. 
 
I can't seem to set a variable that maintains it's value - I can't initialize it to FALSE on the first bar, and then have it increment as I process bars.  Is there a way to do that ?
 
Thanks
-----amibroker@xxxxxxxxxxxxxxx wrote: -----

To: amibroker@xxxxxxxxxxxxxxx
From: "Fred" <ftonetti@xxxxxxxxxxxxx>
Sent by: amibroker@xxxxxxxxxxxxxxx
Date: 01/30/2006 11:49PM
Subject: [amibroker] Re: Initializing Variables once at the start of the program

TradeStation easy language is processed from to top to bottom a bar
at a time ...

AmiBroker AFL is processed from top to bottom with each statement
being executed ONCE and ONLY ONCE ... NOT ONCE PER BAR ...

Unless you build your own Do / While / For Loops and subscript the
ARRAYS then typically each statement works on the entire ARRAY ...

For example ...

If I write the AFL

BS = Ref(H, -1) * 1.001;
SS = Ref(L, -1) * 0.999;

Buy = C > BS;
Sell = C < SS;

Then each of the above statements will be evaulated once ... not once
per bar ...

The first statement will cause an array to be built with each value
along the array being 1.001 * The previous bars high.  Once this
statement is executed or evaluated once it will never be executed or
evaluated again.

The second statement will cause an array to be built with each value
along the array being 0.999 * The previous bars low.

The third and fourth statement evaluate whether buys and sells take
place over the entire history of data that is being looked at ...
again by being evaluated ONCE ... NOT ONCE PER BAR ...

I came from TS as well ... years and years of it ... it is at first
difficult to visualize the concept of array arithmetic but in time
you'll get used to it ...



--- In amibroker@xxxxxxxxxxxxxxx, "clarusinnovation" <mfishburn@xxxx>
wrote:
>
> Hi,
>
> I want to initialize a variable CurrentBar at the start of my
program
> once to 0 - meaning I haven't processed this bar yet. (and a lot of
> other variables I want too)
>
> I don't know how or where to put the variables so they won't get
> initialized every time through the program. I want to keep their
> values as I climb up through the bars.
>
> each bar that counts up, I want to increment this counter.
>
> I tried StaticVariables, but they don't seem to work. How do I
> initialize them ONCE and then increment them from there ?
>
> Please don't tell me to read the manual, I have been up and down
it,
> reading Understanding AFL, it is taking me days to do the simplest
> things...... and it isn't working for me.  I came from Tradestation
> and I could understand bar flow, with Ami I don't.
>
> Please just tell me what to do, and where to put the code.
>
> I tried initalizing the variable in a #Include_ONCE file, that
didn't
> work.
>
> Thanks a lot, it is very frustrating.
>
> Mark
>








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