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

Re: [amibroker] GetNextOpenPos()



PureBytes Links

Trading Reference Links

Sorry TJ, didn't mean to diminish AB power at all.

You're right, I understand I could do any kind of thing with a plugin,
only thing that still escapes me is how to scale down or close a
single trade at will (asked this in another email)

Anyway the reasons I was asking were:

1.efficiency, I want to run this on several years of minute by minute
data, for a few hundreds combinations of parameters and in several
hundreds passes with several passes of Montecarlo-like kind of
scrambling
2. reliability, though I also code for a living I trust your code much
more than mine (not only you're most probably a much better programmer
than I, your code is also going to be tested by all the AB community,
mine would be only tested  by me)
3. I like elegant, short solutions
4. I admit it... I'm laaazy! at times... :)

> In one of the future releases I may add a flag to enable AddToComposite in actionPortfolio.

that would be welcome, thanks. In my case the value of my composite
depends on open trades, and a trade is open not only based on the
signal but also depending on all currently opened trades, so I guess
there's no way to compute the composite in the first pass.

Thanks again,
n

On 8/25/05, Tomasz Janeczko <amibroker@xxxxxx> wrote:
> Hello,
> 
> > -better support for multiple positions on same symbol, not only
> > GetFirstOpenPos() and GetNextOpenPos()  for different sort orders or
> > only for a given symbol, but also: ExitTrade should be working trade
> > by trade on same symbol
> 
> You can do this yourself - iterate through open trades usign GetFirst/NextOpenPos
> and built your own tables using your desired sort. You can write it in native AFL
> or use osaka plugin for that for example or write your own plugin
> (since you mentioned you are professional developer in some other e-mail)
> 
> >
> > -AddToComposite should work in low-level backtesting, *may be some
> > mistake on my part* but in spite of using atcFlagEnableInBacktest I'm
> > not able to actually get values in the composite if I use something
> > like
> 
> AddToComposite works in 1st pass of the backtest when Status("action") == actionBacktest
> (which is repeated for all symbols in the list) when signals are being collected
> and sorted
> During 2nd pass of backtest when Status("action") == actionPortfolio
> which is executed only ONCE regardless on how many symbols are under test,
> AddToComposite calls do not apply. If you need to store values from this second pass
> use OLE automation interface or file writing functions or osaka plugin.
> 
> In one of the future releases I may add a flag to enable AddToComposite in actionPortfolio.
> 
> 
> As to "just not enough for what I'm trying to backtest" -
> you have all tools for every imaginable system already.
> Custom backtester interface (CBI) provides low level control and allows to
> enter/exit/scale ANY trade on ANY symbol ANY time (functions from CBI provide full control over each of these params).
> It also provides an easy way to query any open and/or already open positions.
> This is actually all you need to have to build ANY system.
> You don't need to use array processing at all. You can build your system
> entirely in second pass (first pass doing nothing) and
> It is absolutely up to you what you code.
> The interface is complete: it works like brokerage: you can enter / exit / scale any trade and
> you can query positions. The rest belongs to you.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "neurotic self" <neuroticself@xxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Wednesday, August 24, 2005 4:18 PM
> Subject: Re: [amibroker] GetNextOpenPos()
> 
> 
> > Thanks Thomasz,
> >
> > if I may give some suggestions for further extension to the custom
> > backtester interface (which btw is already very powerful, just not
> > enough for what I'm trying to backtest), I understand some of these
> > may be challenging but...
> >
> > -better support for multiple positions on same symbol, not only
> > GetFirstOpenPos() and GetNextOpenPos()  for different sort orders or
> > only for a given symbol, but also: ExitTrade should be working trade
> > by trade on same symbol
> >
> > -AddToComposite should work in low-level backtesting, *may be some
> > mistake on my part* but in spite of using atcFlagEnableInBacktest I'm
> > not able to actually get values in the composite if I use something
> > like
> >
> > SetCustomBacktestProc("");
> >
> > if( Status("action") == actionPortfolio )
> > {
> >
> >   bo = GetBacktesterObject();
> >
> >   Buy= anything;
> >
> >   bo.PreProcess();
> >
> >   for( i = 0; i < BarCount; i++ )
> >   {
> >
> >      bo.UpdateStats( i, 0 );
> >      bo.HandleStops( i );
> >
> >      p[i] = 5; // composite formula here (eg based on open trades for the bar)
> >
> >      // missing actual buy code here, with bo.EnterTrade
> >
> >      bo.UpdateStats( i, 2 );
> >   }
> >
> >   bo.PostProcess();
> > }
> >
> > AddToComposite(P, "~p", "X", 1+2+4+8);
> >
> > Anybody else feels like those would be valuable improvements?
> >
> > Thanks so far,
> > n.
> >
> >
> >
> >
> > On 8/23/05, Tomasz Janeczko <amibroker@xxxxxx> wrote:
> >> Hello,
> >>
> >> No, GetNextOpenPos always reports positions in the order in which they were entered (FIFO)
> >>
> >> Best regards,
> >> Tomasz Janeczko
> >> amibroker.com
> >> ----- Original Message -----
> >> From: "neurotic self" <neuroticself@xxxxxxxxx>
> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> Sent: Tuesday, August 23, 2005 6:10 PM
> >> Subject: [amibroker] GetNextOpenPos()
> >>
> >>
> >> > Hello,
> >> >
> >> > my strategy requires multiple open positions for the same symbol,
> >> > moreover the next step requires analyzing all currently open positions
> >> > to take a decision on position size.
> >> >
> >> > I was able to code the rules thanks to the custom backtester, problem
> >> > is I have to analyze open positions in ascending or descending entry
> >> > price order.
> >> >
> >> > Is there any way to use GetNextOpenPos() so that trades are reported
> >> > in the desired sequence?
> >> >
> >> > I could write the code to sort positions at every bar but that I'm
> >> > afraid would be very inefficient.
> >> >
> >> > Thanks,
> >> > neuro
> >> >
> >> >
> >> >
> >> > 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
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> > --
> > Janeczko for President!
> >
> >
> >
> > 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
> 
> 
> 
> 
> 
> 
> 


-- 
Janeczko for President!


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hfp181s/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1124993118/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html";>Help tsunami villages rebuild at GlobalGiving. The real work starts now</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/