[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

Intraday live close moves up and down and will stop being a signal or
you may miss it altogether if it moves before your scan occurs. Unless
you only want the value that occurs at the end of a period.
If you want values to give signals intrabar, use Low of High. Once a
new high is reached it does not move down and you will not lose the
signal.

buy = cross( H, ema(close,9) );

My basic golden rules of trading signals
Intrabar setups can only signal using Open, High, Low. Open never
changes after the bar starts. High crossing above a level works, Low
crossing below a level works.
Close price can only ever be used when the signal needs to occur in
the previous  period. ie that bar must be finished as this is the onlt
time that close price is correct and never moves


--
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 2/1/06, Mark Fishburn <mfishburn@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Tomasz, then please help me abandon the thinking.
>
> Using latest beta, trading futures 600 volume tick bars.
>
> Please show me the code to do this please don't redirect me: here is what I
> need to do:
>
> lets say my buy signal is:
>
> buy = cross( close, ema(close,9) );
>
> as soon as the signal is TRUE, I need to capture the price and LOCK in the
> buy signal for the bar. Currently, if the close DURING the bar is lower, the
> buy may turn off. I can't have that, I have sent the order IB and I am
> filled. I need the arrow to point EXACTLY at the price that the signal came
> on at, and the BUYPRICE array reflect the price at that instant, and not
> move.  The signal has to stay on the entire bar.
>
> How do I do that?
>
> I thought of using variables to "lock" in the buy price, but I can't set the
> variable before using it.
>
> I get a: "Variable 'CheckBuy' used without having been initialized.
>
> How do I get around this issue?
>
> Thanks.
>
> Mark.
>
> -----amibroker@xxxxxxxxxxxxxxx wrote: -----
>
> To: <amibroker@xxxxxxxxxxxxxxx>
> From: "Tomasz Janeczko" <amibroker@xxxxxx>
> Sent by: amibroker@xxxxxxxxxxxxxxx
> Date: 01/31/2006 09:40AM
> Subject: Re: [amibroker] Re: Initializing Variables once at the start of the
> program
>
> Hello,
> Abandon this way of thinking. You should forget how TS works and start
> thinking array-wise.
> http://www.amibroker.com/guide/h_understandafl.html
> It is possible to "maintain" value using static variables but it is simpy
> wrong way of approaching
> the coding in AB (like using hammer to kill a fly).
> Once you forget TS and start thinking array-wise you will soon discover
> advantages of it
> including simplicity of code and MUCH faster execution and new possibilities
> NEVER possible in TS
> (like portfolio backtesting which would be extremely memory and time
> inefficient if implemented in TS-execution way).
> <
> http://babelfish.av.com/babelfish/trurl_pagecontent?lp=fr_en&url=http%3A%2F%2Fwww.addictfx.biz%2Farticle-622220-6.html
> >
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: Mark Fishburn
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Tuesday, January 31, 2006 3:04 PM
> Subject: Re: [amibroker] Re: Initializing Variables once at the start of the
> program
>
>
> 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
>
>  Visit your group "amibroker" on the web.
>
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> ________________________________
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/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/