PureBytes Links
Trading Reference Links
|
try this
Further information
Examples and more documentation can be found in this Houston
presentation covering custom backtester interface
(http://www.amibroker.com/docs/Houston2.pdf) (300 KB PDF format) and
the Knowledge Base:
http://www.amibroker.com/kb/category/afl/custom-backtest/
Position sizing is the key of investing (look at kelly criterion for
example) but this forum is not very mathematical and people often tend
to focus more on technical issues than theoretical, so no wonder u get
few replies.
I think you may also have to use a special backtesting mode, i don't
remember the name of, which allows raw signal handling .
Good luck
Ly
--- In amibroker@xxxxxxxxxxxxxxx, "Louis P." <rockprog80@xxx> wrote:
>
> What about something like:
>
> If buy1 then sell 1;
> if buy2 then sell2,
>
> etc.
>
> Is it possible, and if yes, how would you code this?
>
> Thanks,
>
> Louis
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Louis P." <rockprog80@> wrote:
> >
> > Hi,
> >
> > First of all, thank you for your help. I had the impression of
> been
> > alone in a desert, with nobody replying (except for Graham).
> >
> > I didn't find that information and I don't know how to do it. I
> > read the manual, searched on positionsizing, about margin (not
> much
> > info there), but did not find anything that could help me.
> >
> > How would you do this? I'm really not sure how to set an exit
> > number 2 for a buy2 and an exit number 3 for a buy 3 with each
> > signal do not interfering with each others.
> >
> > Do you have any idea?
> >
> > Thanks!
> >
> > Louis
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
> > <loveyourenemynow@> wrote:
> > >
> > > the general idea is to loop through the signal objects and
> change
> > the
> > > property size.
> > > I think there are example of this in the backtester
> documentation.
> > >
> > > Ly
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Louis Préfontaine"
> <rockprog80@>
> > > wrote:
> > > >
> > > > Hi,
> > > >
> > > > I checked for position sizing and found no way to change
> position
> > > for each
> > > > entry, only a general position sizing for each formula. Where
> > > exactly can I
> > > > find the information you are talking about?
> > > >
> > > > Thanks,
> > > >
> > > > Louis
> > > >
> > > > 2008/5/17 loveyourenemynow <loveyourenemynow@>:
> > > >
> > > > > Hi,
> > > > >
> > > > > you can customize position size in the backtesting interface.
> > > > > same for multiple entry etc, I think there is some sample
> code
> > i the
> > > > > help or on the amibroker website under custum backtester.
> > > > > Regarding margin you have to set the general margin as the
> > lowest
> > > > > possible and then stock by stock or trade by trade implement
> > your
> > > > > position sizing strategy.
> > > > >
> > > > > Ly
> > > > >
> > > > > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%
> > 40yahoogroups.com>, "Louis
> > > > > Préfontaine" <rockprog80@>
> > > > > wrote:
> > > > > >
> > > > > > I can hardly believe I am the only one who wants to set
> > different
> > > > > > positionsizing with each trade, and different exits, and
> be
> > able to
> > > > > buy a %
> > > > > > on the first signal and the remaining on a second signal
> (if
> > there
> > > > > is one).
> > > > > > Or maybe I am so wrong with this strategy...
> > > > > >
> > > > > > Louis
> > > > > >
> > > > > > 2008/5/15 Louis Préfontaine <rockprog80@>:
> > > > > >
> > > > > > > Or maybe someone else can help me with this?
> > > > > > >
> > > > > > > Louis
> > > > > > >
> > > > > > > 2008/5/15 Louis Préfontaine <rockprog80@>:
> > > > > > >
> > > > > > > Hi Graham,
> > > > > > >>
> > > > > > >> Thank you very much for your reply.
> > > > > > >>
> > > > > > >> I understand that the margin part may be complicated.
> But
> > is it
> > > > > possible
> > > > > > >> then to adjust the % of equity for each trade if
> > adjusting margin
> > > > > is not
> > > > > > >> possible? (Maybe in future AB version it could be
> > interesting to
> > > > > be able to
> > > > > > >> adjust margin to each trade, because been able to have
> a
> > 33
> > > > > margin, for
> > > > > > >> example, doesn't mean one wants to use full margin each
> > time...).
> > > > > > >>
> > > > > > >> But what about how to buy 50% of equity on first signal
> > and to be
> > > > > able to
> > > > > > >> act on the second one? I think it should be possible...
> I
> > don't
> > > > > understand
> > > > > > >> why acting on the first signal makes it impossible to
> act
> > on the
> > > > > second. I
> > > > > > >> tried using the sigscalein command but it wasn't a
> > success... Do
> > > > > you have
> > > > > > >> something to recommand me on this? I read the manual and
> > > > > searched and
> > > > > > >> experimented but it wasn't successful...
> > > > > > >>
> > > > > > >> Thank you
> > > > > > >>
> > > > > > >> Louis
> > > > > > >>
> > > > > > >> 2008/5/14 Graham <kavemanperth@>:
> > > > > > >>
> > > > > > >> Hi Louis
> > > > > > >>> I will admit I have not thought too much on how you
> can
> > do
> > > this as I
> > > > > > >>> do not have the time to put aside. I would consider
> your
> > > best method
> > > > > > >>> would be via advanced backtest code to alter the
> > requirements of
> > > > > entry
> > > > > > >>> and exit
> > > > > > >>>
> > > > > > >>> --
> > > > > > >>> Cheers
> > > > > > >>> Graham Kav
> > > > > > >>> AFL Writing Service
> > > > > > >>> http://www.aflwriting.com
> > > > > > >>>
> > > > > > >>> 2008/5/15 Louis P. <rockprog80@ <rockprog80%
> > 40gmail.com>>:
> > > > > > >>>
> > > > > > >>> > Hmmm... Maybe I'm too boring or... well, nobody
> seems
> > to be
> > > > > able or
> > > > > > >>> > want to help me with this.
> > > > > > >>> >
> > > > > > >>> > Maybe I ask too many question and don't help others
> > enough?
> > > > > > >>> >
> > > > > > >>> > At least that'll be something to think about.
> > > > > > >>> >
> > > > > > >>> > Louis
> > > > > > >>> >
> > > > > > >>> >
> > > > > > >>> > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%
> > 40yahoogroups.com>
> > > > > <amibroker%40yahoogroups.com>, "Louis
> > > > > > >>> Préfontaine"
> > > > > > >>> > <rockprog80@> wrote:
> > > > > > >>> >>
> > > > > > >>> >> Hi again (sorry for all the messages),
> > > > > > >>> >>
> > > > > > >>> >> I tried to use sigscalein but it isn't a big
> success
> > yet.
> > > With
> > > > > > >>> > the code
> > > > > > >>> >> below, the system buys 50% on the first signal
> (which
> > is
> > > ok), but
> > > > > > >>> > ignores
> > > > > > >>> >> the next one. I'd like to be able to buy 50% on
> March
> > 3
> > > (with a
> > > > > > >>> > rule
> > > > > > >>> >> planning to sell three days later) and buy another
> > 50% on
> > > March 4
> > > > > > >>> > (with
> > > > > > >>> >> another exit rule) but even after looking in the
> > manual and
> > > > > trying
> > > > > > >>> >> everything I could I didn't find how to do it.
> > > > > > >>> >>
> > > > > > >>> >> Same problem with trying to change the margin for
> each
> > > trade. I
> > > > > > >>> > know how to
> > > > > > >>> >> set the margin for the overall system, but I'd like
> to
> > > change how
> > > > > > >>> > much
> > > > > > >>> >> margin and equity I use with each trade.
> > > > > > >>> >>
> > > > > > >>> >> Anyone would be kind enough to help me with that?
> > Thank
> > > you very
> > > > > > >>> > much.
> > > > > > >>> >> Please note that I first asked about this on May 6
> > > (#123500) so I
> > > > > > >>> > did a lot
> > > > > > >>> >> of work by myself; but now I just don't know how to
> go
> > > futher.
> > > > > > >>> >>
> > > > > > >>> >> Thank you very much,
> > > > > > >>> >>
> > > > > > >>> >> Louis
> > > > > > >>> >>
> > > > > > >>> >> SetPositionSize( 50, spsPercentOfEquity );
> > > > > > >>> >> SetOption("MaxOpenPositions", 2 );
> > > > > > >>> >>
> > > > > > >>> >> Buy1 = ( rule1 );
> > > > > > >>> >> //Buy1 = ExRem ( Buy1, 3 );
> > > > > > >>> >> //Sell1 = Ref ( Buy1, -3 );
> > > > > > >>> >> Sell1 = BarsSince(Buy1) == 3;
> > > > > > >>> >> InTrade1 = Flip( Buy1, Sell1 );
> > > > > > >>> >> DoScaleIn1 = ExRem( InTrade1, Sell1 );
> > > > > > >>> >>
> > > > > > >>> >> Buy2 = rule2 ;
> > > > > > >>> >> //Buy2 = ExRem( Buy2, 5 );
> > > > > > >>> >> //Sell2 = Ref ( Buy2, -5 );
> > > > > > >>> >> Sell2 = BarsSince(Buy2) == 5;
> > > > > > >>> >> InTrade2 = Flip( Buy2, Sell2 );
> > > > > > >>> >> DoScaleIn2 = ExRem( InTrade2, Sell2 );
> > > > > > >>> >>
> > > > > > >>> >> Buy3 = rule3 ;
> > > > > > >>> >> //Buy3 = ExRem ( Buy3, 2 );
> > > > > > >>> >> //Sell3 = Ref ( Buy3, -2 );
> > > > > > >>> >> Sell3 = BarsSince(Buy3) == 2;
> > > > > > >>> >> InTrade3 = Flip( Buy3, Sell3 );
> > > > > > >>> >> DoScaleIn3 = ExRem( InTrade3, Sell3 );
> > > > > > >>> >>
> > > > > > >>> >> Buy4 = rule4 ;
> > > > > > >>> >> //Buy4 = ExRem ( Buy4, 1 );
> > > > > > >>> >> //Sell4 = Ref ( Buy4, -1 );
> > > > > > >>> >> Sell4 = BarsSince(Buy4) == 1;
> > > > > > >>> >> InTrade4 = Flip( Buy4, Sell4 );
> > > > > > >>> >> DoScaleIn4 = ExRem( InTrade4, Sell4 );
> > > > > > >>> >>
> > > > > > >>> >> Buy = (Buy1 + sigScaleIn*doscalein1) OR (Buy2 +
> > > > > > >>> > sigScaleIn*doscalein2) OR
> > > > > > >>> >> (Buy3 + sigScaleIn*doscalein3) OR (Buy4 +
> > > sigScaleIn*doscalein4);
> > > > > > >>> >> Sell = Sell1 OR Sell2 OR Sell3 OR Sell4;
> > > > > > >>> >>
> > > > > > >>> >> 2008/5/13 Louis Préfontaine <rockprog80@>:
> > > > > > >>> >>
> > > > > > >>> >> > Hi there,
> > > > > > >>> >> >
> > > > > > >>> >> > Here is what I managed to achieve:
> > > > > > >>> >> >
> > > > > > >>> >> > SetPositionSize( 50, spsPercentOfEquity );
> > > > > > >>> >> > SetOption("MaxOpenPositions", 2 );
> > > > > > >>> >> >
> > > > > > >>> >> > Buy1 = rule1;
> > > > > > >>> >> > Sell1 = BarsSince(Buy1) == 3;
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> > Buy2 = rule2 ;
> > > > > > >>> >> > Sell2 = BarsSince(Buy2) == 5;
> > > > > > >>> >> >
> > > > > > >>> >> > Buy3 = rule3 ;
> > > > > > >>> >> > Sell3 = BarsSince(Buy3) == 2;
> > > > > > >>> >> >
> > > > > > >>> >> > Buy4 = rule4;
> > > > > > >>> >> > Sell4 = BarsSince(Buy4) == 1;
> > > > > > >>> >> >
> > > > > > >>> >> > Buy = Buy1 OR Buy2 OR Buy3 OR Buy4 ;
> > > > > > >>> >> > Sell = Sell1 OR Sell2 OR Sell3 OR Sell4;
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> > Two problems remain:
> > > > > > >>> >> >
> > > > > > >>> >> > 1) I'd like to establish a margin of 100 for rule
> 1
> > and
> > > 2, a
> > > > > > >>> > margin of 50
> > > > > > >>> >> > for rule 3 and a margin of 33 for rule 4. Don't
> know
> > > how to do
> > > > > > >>> > it;
> > > > > > >>> >> > 2) Some of my signals cross each other; I want
> each
> > > signal to
> > > > > > >>> > buy 50% of
> > > > > > >>> >> > the equity leaving the other 50% "ready" for
> > another signal
> > > > > > >>> > while the first
> > > > > > >>> >> > signal is still open... Right now with that code
> I
> > only
> > > get the
> > > > > > >>> > first
> > > > > > >>> >> > signal and the second one is ignored. E.g. If
> Buy2
> > enters a
> > > > > > >>> > position on
> > > > > > >>> >> > May 5 and there is a signal on May 6, May 6
> signal
> > will get
> > > > > > >>> > ignored. What I
> > > > > > >>> >> > want is 50% on May 5 and if a signal comes on May
> 6
> > I want
> > > > > > >>> > another 50%. Is
> > > > > > >>> >> > this possible?
> > > > > > >>> >> >
> > > > > > >>> >> > Thanks again,
> > > > > > >>> >> >
> > > > > > >>> >> > Louis
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> >
> > > > > > >>> >> > 2008/5/13 Louis Préfontaine <rockprog80@>:
> > > > > > >>> >> >
> > > > > > >>> >> > Hi again,
> > > > > > >>> >> >>
> > > > > > >>> >> >> Ok here is what I am trying to do. I'll try to
> add
> > as much
> > > > > > >>> > details as I
> > > > > > >>> >> >> can.
> > > > > > >>> >> >>
> > > > > > >>> >> >> There is three different conditions on which I
> > want to
> > > react
> > > > > > >>> > differently.
> > > > > > >>> >> >>
> > > > > > >>> >> >> Condition 1) I buy the stock with full margin
> and
> > full
> > > power
> > > > > > >>> > and exits
> > > > > > >>> >> >> after 10 days;
> > > > > > >>> >> >> Condition 2) I buy the stock with no margin and
> > exits
> > > after 10
> > > > > > >>> > days;
> > > > > > >>> >> >> Condition 3) I buy the stock with no margin and
> > with
> > > less than
> > > > > > >>> > 50% of my
> > > > > > >>> >> >> equity and exits after 5 days.
> > > > > > >>> >> >>
> > > > > > >>> >> >> I am looking for a code to do this. It does not
> > look that
> > > > > > >>> > complicated,
> > > > > > >>> >> >> but I don't know how to do it.
> > > > > > >>> >> >>
> > > > > > >>> >> >> If someone has any idea...
> > > > > > >>> >> >>
> > > > > > >>> >> >> Thanks,
> > > > > > >>> >> >>
> > > > > > >>> >> >> Louis
> > > > > > >>> >> >>
> > > > > > >>> >> >>
> > > > > > >>> >> >>
> > > > > > >>> >> >> 2008/5/13 louisprefontaine <rockprog80@>:
> > > > > > >>> >> >>
> > > > > > >>> >> >> Anyone?
> > > > > > >>> >> >>>
> > > > > > >>> >> >>> Thanks,
> > > > > > >>> >> >>>
> > > > > > >>> >> >>> Louis
> > > > > > >>> >> >>>
> > > > > > >>> >> >>> --- In
> > > amibroker@xxxxxxxxxxxxxxx<amibroker%40yahoogroups.com>
> > > > > <amibroker%40yahoogroups.com><amibroker%
> > > > > > >>> > 40yahoogroups.com>, "Louis
> > > > > > >>> >> >>> Préfontaine" <rockprog80@>
> > > > > > >>> >> >>> wrote:
> > > > > > >>> >> >>>
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>> > Hi,
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>> > I am looking for a way to set different sell
> > signals
> > > > > > >>> > depending on
> > > > > > >>> >> >>> particular
> > > > > > >>> >> >>> > buy signals. E.G. For cond1 I want a
> particular
> > > sell, and
> > > > > > >>> > for cond2
> > > > > > >>> >> >>> > another particular sell.
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>> > Also, I'd like to set a different equity
> > management for
> > > > > each
> > > > > > >>> > condition.
> > > > > > >>> >> >>> > E.g. For cond1 I want to use 50 margin, for
> > cond2
> > > 33 margin
> > > > > > >>> > and for
> > > > > > >>> >> >>> cond 3
> > > > > > >>> >> >>> > 100 margin, etc.
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>> > Anyone can help me with that?
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>> > Thanks,
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>> > Louis
> > > > > > >>> >> >>> >
> > > > > > >>> >> >>>
> > > > > > >>> >> >>>
> > > > > > >>> >> >>>
> > > > > > >>> >> >>
> > > > > > >>> >> >>
> > > > > > >>> >> >
> > > > > > >>> >>
> > > > > > >>> >
> > > > > > >>> >
> > > > > > >>> >
> > > > > > >>> > ------------------------------------
> > > > > > >>> >
> > > > > > >>> > 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 NEW RELEASE ANNOUNCEMENTS and other news always
> > check
> > > DEVLOG:
> > > > > > >>> > http://www.amibroker.com/devlog/
> > > > > > >>> >
> > > > > > >>> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|