PureBytes Links
Trading Reference Links
|
Hello,
Here is the sample:
// This is sample
formula that allows
// to open multiple, separate positions on the
same symbol
// without averaging effect (i.e. each position
on the same
// symbol is completely
independent).
// // Sample code is provided for
trading one symbol
// Enter symbol you want to trade
below Symbol =
"MSFT";
Buy=Sell=Short=Cover=0;
// real rules are defined inside custom backtest
proc
// Exits will be done only by
stops
ApplyStop(
stopTypeProfit,
stopModePercent,
5, True );
SetCustomBacktestProc(""); //
enable custom backtest
if( Status("action")
== actionPortfolio ) {
// actual backtest
routine
//
(low-level)
bo = GetBacktesterObject();
SetForeign( Symbol ); //
make sure to calculate actual buy and buyprice arrays for symbol we need to
backtest
Buy=Ref(Open,0) <
Ref(Low,-1) AND Ref(Avg,0) < Ref(Avg,-1) AND Ref(Avg,-1) < Ref(Avg,-2);
BuyPrice = Open; RestorePriceArrays();
// actual
backtest loop
bo.PreProcess();
for( i = 1; i < BarCount; i++ ) {
// first
update backtest stats and handle stops
bo.UpdateStats( i, 0 );
bo.HandleStops( i );
if( Buy[ i - 1 ] ) // if
buy signal in previous bar {
//bo.RawTextOutput("ENTRY, bar " + i );
bo.EnterTrade( i,
Symbol, True,
BuyPrice[ i ],
5000 /* $5000 into one trade */);
}
bo.UpdateStats( i, 2 );
}
bo.PostProcess(); } Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Thursday, March 24, 2005 1:12 AM
Subject: [amibroker] Re: Multiple Positions, same
Security
> > > TJ, > > This is obviously very easy
for you to do as opposed to at least some > of the rest of us who are
floundering around ... how about taking > example and showing the code
for it i.e. multiple entry points with > multiple corresponding exits
where exit price is 5% above the related > entry. > > Thanks
in advance, Fred > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz
Janeczko" <amibroker@x...> >
wrote: >> Hello, >> >> > Very disappointed with
Thomasz response (or lack of). >> I have responded, so I
don't know why you are suggesting "lack of > response". >>
http://finance.groups.yahoo.com/group/amibroker/message/79806 >> >> > All I want to >> > do
is track and manage the SELL's of the individual BUY's, > instead
of >> > lumping in and averaging. I assume Thomasz
avoidance of the >> > objective was confirmation. >>
>> Again, regardless as you call it, you are increasing position hold
> on single security, >> and this is essentially scaling in.
Plain fact. >> >> Scaling mechanism in AB is superior to
Wealth-Lab because >> you can for example scale-in 12 times then scale
out 4 times then > scale in 6 times >> and then scale out 40
times, each scale in/out having different > size. >> Coding this
in Wealth-Lab would be nightmare because you would need >> to "join"
and "divide" positions by hand. >> >> > Apparently, this
isn't possible with AB >> > and unfortunately look's like it may be
useless for my trading > purposes. >> >> Werner von
Braun said: >> "I have learned to use the word impossible with the
greatest > caution. " >> >> And for your information
it is perfectly possible to code your > system in AmiBroker. >>
What's more you can even do it W-L way (i.e. without "averaging" > that
you are so afraid of) >> using backtester interface: >>
http://www.amibroker.com/guide/a_custombacktest.html >> >> Best regards, >> Tomasz
Janeczko >> amibroker.com >> >> ----- Original
Message ----- >> From: "Jeff" <jeffstr@x...> >> To: <amibroker@xxxxxxxxxxxxxxx> >> Sent: Wednesday, March 23, 2005 3:44 PM >>
Subject: [amibroker] Re: Multiple Positions, same Security >>
>> >> > >> > >> > --- In
amibroker@xxxxxxxxxxxxxxx, "Fred"
<ftonetti@x...> wrote: >>
>> >> >> >> > Hi Fred, EOD
System. Very simple to code in AB. >> > >>
> Buy=Ref(Open,0) < Ref(Low,-1) AND Ref(Avg,0) < Ref(Avg,-1) AND
>> > Ref(Avg,-1) < Ref(Avg,-2); >> > >>
> Very disappointed with Thomasz response (or lack of). All I
> want to >> > do is track and manage the SELL's of the
individual BUY's, > instead of >> > lumping in and
averaging. I assume Thomasz avoidance of the >> >
objective was confirmation. Apparently, this isn't possible >
with AB >> > and unfortunately look's like it may be useless for my
trading > purposes. >> > >> > --Jeff
>> > >> > >> > >> >
>> > >> > >> > 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 --------------------~--> > What would our lives be like
without music, dance, and theater? > Donate or volunteer in the arts today
at Network for Good! > http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/ > > > > >
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
|