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

RE: [amibroker] Re: how to get rid of multiple signals from the same stock?



PureBytes Links

Trading Reference Links

Rick,

RE: Array processing.

Your questions show that I have not explained well enough. This is the
"hard part" of array processing, especially for programmers used to
looping code (which is most all kinds of programming).

What I mean by "Basically the Buy = line is executed ONCE for all bars
and it never looks back" is the entire array from bar 0 to bar 5000 (or
however much data you have) is processed "all at once". Then the next
line of code is executed "all at once for all bars of data". Arrays do
not go back and forth between different lines of code as you are
expecting.

So, your Buy array may look like this when it's processed: 
//Where each digit represent a bar of data
In_trade        = 000000000000000000000
Buy             = 000110001010001000011 
Sell            = 000000100100010100001
ExRem(Buy,Sell) = 000100001010001000010 //Eliminates double Buys
In_Trade        = 000111001010001000010 //= 1 when on Buy

So, while you see the value of in_trade in the interpretation window
your code has finished executing and the value of in_trade, as shown
above is what you see, BUT at the time the Buy = was executed the value
of in_trade was ALL ZERO so your Buy signal does NOT see any of the
in_trade status.

This problem can be fixed by using looping code so instead of computing
all bars of data once (and never "looking back") you can compute the Buy
for the first bar of data, store the value of in_trade, compute the Buy
for the 2nd bar of data and refer to in_trade[i-1] to see if you are
currently on a buy or not. (If you need some sample code I can do that.)

I hope I am clear this time. This is the major point everyone (including
myself) gets stuck on when trying to get their minds wrapped around
array processing. 
--
Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of ricko8294_98
Sent: Thursday, December 08, 2005 18:12
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: how to get rid of multiple signals from the
same stock?

Thanks for your reply.
I do have money - but it is tht next trade I DON'T want to take so it 
is no that - it is something in the code.
I appreciate your comments about array processing - something I 
haven't quite sorted out in my mind yet.

In the interest of my learning something here, you said the Buy = 
line is executed once for all bars - yet there are often many buys 
looking back into history - so buys happen more than once. 

I can also see the value of in_trade in the Interpretation window 
(using Writeval() )and watch it change from 0 to 1 when the first 
trade of the day occurs.  Yet the second buy in the same day occurs 
with in_trade = 1 even though one of the criteria for the Buy is that 
in_trade be equal to zero.  I may be trying to make things more 
simple than they are - but I still do not understand.

I do thank you for your input 
Rick

--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
>
> Something to check...do you have money available to take the 
additional
> trade?
> 
> Also I don't believe your code below will work due to ARRAY 
processing.
> In order to track in_trade, you will need to build a loop and 
generate
> Buy / Sell signals on a day by day basis. Basically the Buy = line 
is
> executed ONCE for all bars and it never looks back so your in_trade
> Array = 0 for all bars at the time the Buy statement is executed. 
You
> can't see this in a plot or Explore because that happens after 
in_trade
> is computed. 
> 
> in_trade = 0; // to control one trade per day
> nuday = Day() != Ref(Day(),-1);  // to indicate a new day
> 
> Then my Buy code is
> Buy = in_trade ==  0 AND LongCond1 AND {the rest of my buy 
conditions}
> 
> then comes my Sell code
> 
> followed by
> Buy = exrem(buy,sell);
> 
> and
> 
> in_trade = Flip( Buy, nuday);  / to reset in_trade for 
> the next day
> 
> --
> Terry
> 
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On
> Behalf Of ricko8294_98
> Sent: Thursday, December 08, 2005 15:35
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: how to get rid of multiple signals from the
> same stock?
> 
> Interesting chat about Yahoo delays, but I still don't have a 
> satisfactory answer to my original question as to why AB ignores 
some 
> variable values in a subsequent BUY signal on the same stock in the 
> same day
> Rick
> --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxxx> 
wrote:
> >
> > Hi - I was experiencing long delays (and still am sometimes ) 
> between the time I posted a message and the time it appeared here - 
> often hours, even *days* a couple of times. A while back I decided 
to 
> start tracing my posts and discovered that the delay was usually 
not 
> Yahoo's fault, it was occurring between 2 of Comcasts servers. 
Seems 
> that service should be better for $50/month...   Just thought I 
would 
> pass it along...
> > 
> > Steve
> >   ----- Original Message ----- 
> >   From: Joe Landry 
> >   To: amibroker@xxxxxxxxxxxxxxx 
> >   Sent: Thursday, December 08, 2005 8:46 AM
> >   Subject: Re: [amibroker] Re: how to get rid of multiple signals 
> from the same stock?
> > 
> > 
> >   Intermilan04
> > 
> >   Should be less than 10 hours unless you're waiting for the 
daily 
> digest! 
> >   The response times that I experience between posting a note and 
> seeing it on the forum is
> >   minutes. 
> >   Just ran a test just for you and it was less than 2 minutes out 
> at 7:42 on the
> >   Yahoo group forum at 7:44.
> > 
> >   I'll agree the search is frustrating. 
> > 
> >   Best regards
> >   Joe 
> >     
> >     ----- Original Message ----- 
> >     From: intermilan04 
> >     To: amibroker@xxxxxxxxxxxxxxx 
> >     Sent: Thursday, December 08, 2005 12:26 AM
> >     Subject: [amibroker] Re: how to get rid of multiple signals 
> from the same stock?
> > 
> > 
> >     You have a valid point.  I might add that this board takes 
ten 
> hours
> >     before your message gets posted, too.
> > 
> >     --- In amibroker@xxxxxxxxxxxxxxx, "siu_john" <siu_john@xxxx> 
> wrote:
> >     >
> >     > Well, I for one always want to search thru all messages 
first 
> before
> >     > posting since I like instant answers (but I am extremely 
> impressed
> >     > with the amibroker staff's response time, which is pretty 
> close to
> >     > instant :).  However, in this group, it is almost 
impossible 
> since
> >     > Yahoo groups don't provide that functionality.  They 
require 
> you to
> >     > click a million times in order to search thru all 
messages.  
> Each
> >     > search only searches 1% or so of the messages, even when no 
> results
> >     > are found within that percentage! -- I have no idea why 
Yahoo 
> groups
> >     > is so behind..  Google groups or almost any other msg 
boards 
> search
> >     > thru all messages instantly.  I believe much of the staff's 
> time can
> >     > be saved from answering repeat questions if this forum is 
> moved to a
> >     > better one.
> >     > -john
> >     > 
> >     > --- In amibroker@xxxxxxxxxxxxxxx, Graham 
<kavemanperth@xxxx> 
> wrote:
> >     > >
> >     > > I think you will find you need to put this into a for 
loop, 
> or add
> >     > > more variables
> >     > > 
> >     > > Have you tried doing a search on the group archives as 
this 
> sae
> >     > > question has been discussed a number of times
> >     > > 
> >     > > --
> >     > > 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 12/8/05, ricko8294_98 <ricko@xxxx> wrote:
> >     > > > I am having a similar problem with eliminating a second 
> (or more)
> >     > > > trades on the same stock during the same day.  I have 
> included exrem
> >     > > > to eliminate multiple buys before a sell signal is 
given 
> and I don't
> >     > > > want to use a time restriction.
> >     > > >
> >     > > > What my 3 minute bar system has (in part) is the 
> following:
> >     > > >
> >     > > > in_trade = 0; // to control one trade per day
> >     > > > nuday = Day() != Ref(Day(),-1);  // to indicate a new 
day
> >     > > >
> >     > > > Then my Buy code is
> >     > > > Buy = in_trade ==  0 AND LongCond1 AND {the rest of my 
buy
> >     conditions}
> >     > > >
> >     > > > then comes my Sell code
> >     > > >
> >     > > > followed by
> >     > > > Buy = exrem(buy,sell);
> >     > > >
> >     > > > and
> >     > > >
> >     > > > in_trade = Flip( Buy, nuday);  / to reset in_trade for 
> the next day
> >     > > > but retain the value (which becomes "1" on the bar 
where 
> the first
> >     > > > buy is executed).
> >     > > >
> >     > > > The system will occasionally issue a second buy signal 
on 
> the SAME
> >     > > > stock on the SAME day (I can tell because I plot the 
buy 
> arrows)
> >     EVEN
> >     > > > THOUGH the Interpretation window tells me the value of 
> in_trade at
> >     > > > that point is 1 (not 0 as required by the Buy code).
> >     > > >
> >     > > > So - 2 questions
> >     > > > 1 how can I eliminate the second trade on the same 
stock 
> on the same
> >     > > > day (my primary objective)?
> >     > > >
> >     > > > 2. why does the Buy code ignore the in_trade ==0 part 
of 
> the code?
> >     > > >
> >     > > > TIA
> >     > > > Rick
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > > --- In amibroker@xxxxxxxxxxxxxxx, Graham 
> <kavemanperth@xxxx> wrote:
> >     > > > >
> >     > > > > you can use exrem to remove additional signals
> >     > > > > you can use code to only include the first signal of 
> the day, or
> >     > > > even
> >     > > > > withi certain time paramters, and exclude others
> >     > > > > It is just matter of adding the right conditions to 
the 
> buy/sell
> >     > > > statements
> >     > > > >
> >     > > > > Buy = ???;
> >     > > > > Sell = ???;
> >     > > > > Buy = exrem(buy,sell);
> >     > > > >
> >     > > > > eg if you only want to buy beofre 10am in the morning
> >     > > > > Buy = YourBuyConditions and timenum()<100000;
> >     > > > >
> >     > > > > There are a few other ways but could need tailoring 
to 
> your system
> >     > > > > --
> >     > > > > 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 12/7/05, siu_john <siu_john@xxxx> wrote:
> >     > > > > > Hi Tomasz or anyone,
> >     > > > > >  I am doing AA scans/explores on a group or all of 
my 
> stocks and
> >     > > > in
> >     > > > > > too many times, the signal happens multiple times 
> thru out the
> >     > > > day for
> >     > > > > > the same stock.  Thus my results are flooded with 
too 
> many
> >     siganls
> >     > > > > > instead of the only few stocks that are actually 
> returned.
> >     > > > > > I am wondering how do I return either:
> >     > > > > >  - the latest signal only per stock (for latest 
> signal purpose)
> >     > > > > >  and/or
> >     > > > > >  - the first signal and skip to analyse next stocks 
> in question
> >     > > > (for
> >     > > > > > execution speed purpose)
> >     > > > > >
> >     > > > > > Also, is there a _REAL_ reason to seperate the 
> functionality of
> >     > > > Scans
> >     > > > > > and Explorations?  I find it that I like reporting 
> power of
> >     > > > > > explorations (Scans don't execute Filters, AddColumn
()
> s, etc.)
> >     > > > and the
> >     > > > > > automation of scans (checkbox of "Scan every x-
> minutes" don't
> >     > > > apply to
> >     > > > > > explorations).   But seems like I can't have both 
> because of the
> >     > > > > > artifically created distinctions..  It would be so 
> great if
> >     we can
> >     > > > > > have both! (unless there's a much better reason for 
> the
> >     > > > seperation).
> >     > > > > >
> >     > > > > > thank you so much,
> >     > > > > > -john
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > > 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
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > > >
> >     > > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > > 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
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > > >
> >     > >
> >     >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >     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 
> > 
> >       a..  Visit your group "amibroker" on the web.
> >         
> >       b..  To unsubscribe from this group, send an email to:
> >        amibroker-unsubscribe@xxxxxxxxxxxxxxx
> >         
> >       c..  Your use of Yahoo! Groups is subject to the Yahoo! 
Terms 
> of Service. 
> > 
> > 
> > ------------------------------------------------------------------
--
> --------
> >
> 
> 
> 
> 
> 
> 
> 
> 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
>








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



 





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