PureBytes Links
Trading Reference Links
|
Fred, I can understand your problem with loops making some
optimisations longer, but you do not opt a system forever.
There are times when standard array processing will not provide a
solution to creating the trading system you want, and loops are
required. In the case this thread is about there was no actual sell
signal, using applystops instead, except for the stop loss exit. As
this required only the original buy signal and any subsequent buy
signals that occur afffect the stop value, then a loop had to be used.
Ideally using exrem, exremspan would be implemented or in my earlier
example Flip, but again only if you can define the second end point
after within the functions. This was not the case we were discussing.
So loops are the alternative to get the system to work.
I think yu would have to agree that spending longer time optimising is
a better alternative to having no system at all.
I will also point out, and I will add this to my signature. I provide
examples of how to solve the problem being asked about. There will
generally always be alternative ways to achieve the same end as so
often can be seen in the varied responses to questions. I also tend to
just type an answer into the email, occasionally resorting to checking
in AB only when I consider it necessary. Like in this case I needed to
check the bracket closures and ensure I had covered the loop
conditions. As I provide an example only of how to do it, I leave it
to the person to either use my suggestion and make it work for there
particular case or ignore it in favour of someone elses method.
On 8/9/05, Fred <ftonetti@xxxxxxxxxxxxx> wrote:
> My comment was not about Graham's code per se ... it's fine for loop
> processing ... but there's no getting around the fact that loop
> processing runs slower then array processing which SCREAMS ... will
> users even really notice the difference in a backtest or an
> indicator ? no ... will they notice it in optimizations ? ... In a
> lot of cases they will
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
> wrote:
> > I woudn't say that. Graham's code is very good (uses scalars only)
> and will run very fast.
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: "Fred" <ftonetti@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, August 09, 2005 12:37 AM
> > Subject: [amibroker] Re: Exit on first profitable open
> >
> >
> > > That'll certainly work ... but it's overkill and run times will
> > > expand dramatically.
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx>
> wrote:
> > >> because an intital sell signal was not defined to enable the use
> of
> > >> exrem, or other methods to exclude surplus buy signals you
> probably
> > >> need to use a loop method
> > >> something along these lines
> > >>
> > >> buy = conditions;
> > >> Sell = 0;
> > >> intrade = 0;
> > >> holdO = Null;
> > >>
> > >> for(i=1;i<BarCount;i++)
> > >> {
> > >> if( Buy[i] AND intrade[i-1]==0 )
> > >> {
> > >> intrade[i] = 1;
> > >> HoldO[i] = O[i];
> > >> }
> > >> else
> > >> {
> > >> intrade[i] = intrade[i-1];
> > >> HoldO[i] = HoldO[i-1];
> > >> }
> > >> if( O[i] > HoldO[i] AND intrade[i-1])
> > >> {
> > >> Sell[i] = 1;
> > >> Intrade[i] = 0;
> > >> }
> > >> else
> > >> {
> > >> Sell[i] = 0;
> > >> }
> > >> }
> > >>
> > >>
> > >> On 8/9/05, Fred <ftonetti@xxxx> wrote:
> > >> > The example I provided would of course be for same day trading
> on
> > > the
> > >> > buy side ... If what you want is delayed a bar because you are
> > > buying
> > >> > on the Open of the following bar then it would be one bar less
> > > i.e.
> > >> >
> > >> > Sell = O > Ref(O, -(BSB - 1));
> > >> >
> > >> > If this doesn't work for you then you need to be more specific
> > > about
> > >> > exactly what is happening and how that compares with what you
> are
> > >> > after.
> > >> >
> > >> >
> > >> > --- In amibroker@xxxxxxxxxxxxxxx, "Peter" <pa299@xxxx> wrote:
> > >> > > Fred
> > >> > > Thanks but been there.
> > >> > > As I understand it BarsSince(Buy); will return the bars to
> the
> > > last
> > >> > Raw
> > >> > > buy signal. You may have the actual Buy entry then one or
> more
> > >> > other buy
> > >> > > signals which are ignored ( assuming you include the line
> > >> > > Buy=ExRem(Buy,Sell);) then the sell signal. BarsSince(Buy);
> will
> > >> > return
> > >> > > the bars to last Buy signal not the one where you entered the
> > >> > trade.
> > >> > > That's the bit I can't solve.
> > >> > > Peter
> > >> > >
> > >> > >
> > >> > > -----Original Message-----
> > >> > > From: amibroker@xxxxxxxxxxxxxxx
> > > [mailto:amibroker@xxxxxxxxxxxxxxx]
> > >> > On
> > >> > > Behalf Of Fred
> > >> > > Sent: Tuesday, 9 August 2005 7:38 a.m.
> > >> > > To: amibroker@xxxxxxxxxxxxxxx
> > >> > > Subject: [amibroker] Re: Exit on first profitable open
> > >> > >
> > >> > > Assuming you have an impulse type buy i.e.
> > >> > >
> > >> > > Buy = Cross(X, Y);
> > >> > >
> > >> > > then ...
> > >> > >
> > >> > > BSB = BarsSince(Buy);
> > >> > >
> > >> > > ... should give you how many bars it's been since the buy
> > >> > occured ...
> > >> > >
> > >> > > Then assuming that you also bought at an opening ... then ...
> > >> > >
> > >> > > Sell = O > Ref(O, -BSB);
> > >> > >
> > >> > > --- In amibroker@xxxxxxxxxxxxxxx, "Peter" <pa299@xxxx> wrote:
> > >> > > > Hi
> > >> > > > After spending a huge amount of time trying to code an
> `Exit
> > > on
> > >> > the
> > >> > > > first profitable open' I give up.
> > >> > > > Is anyone willing to share the code for what should be a
> very
> > >> > simple
> > >> > > > exit?????
> > >> > > >
> > >> > > > Any help would be appreciated!!
> > >> > > > Peter
> > >> > >
> > >> > >
> > >> > >
> > >> > >
> > >> > >
> > >> > > 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
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >>
> > >>
> > >> --
> > >> 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
> > >
> > >
> > >
> > >
> > >
> > > 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
>
>
>
>
>
>
>
--
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
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h1ivall/M=362131.6882500.7825259.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123552220/A=2889190/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Put more honey in your pocket. (money matters made easy) Welcome to the Sweet Life - brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
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/
|