PureBytes Links
Trading Reference Links
|
That makes it clearer
Hers is one way to do it, another is to use a for loop, but try the
simpler first
change your buy to buysig in your code
buysig = yourbuyconditions;
EndOfDay = cross( timenum(), 155959 ); //for end of trading day 160000
DoneTrade = flip(buysig,endofday);
buy = buysig and ref(donetrade,-1)==0;
--
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/9/05, ricko8294_98 <ricko@xxxxxxxxxx> wrote:
> As I mentioned, I use Exrem to get rid of extra Buy signals before a
> sell signal.
>
> If I get a Buy then a sell (a completed trade)in the same day, then I
> don't want a second trade in that stock that day.
>
> Rick
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> >
> > One thing needs clarification as I am confused to your requirements
> >
> > Are you trying to remove unwanted buy signals until a sell signal
> occurs
> > OR
> > Are you wanting to remove additional trades during the day after the
> > first one is completed?
> >
> >
> > --
> > 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/9/05, ricko8294_98 <ricko@xxxx> wrote:
> > > 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
> >
------------------------ 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/
|