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

[amibroker] Re: Backtester: same bar various scaleout and one sell signal (3)



PureBytes Links

Trading Reference Links

Tomasz,
thanks for your guidance. Fun programming custom backtester, signal
decoding not straightforward but it works. Have some additional
questions please:
1-Noticed that in AA window, date column is empty while information
column is ok. On report->trades, trade bar information is ok. What am
I missing to get bar date-time in AA window?

2-Trying multiple scaleout, common practice among futures and FX
traders, since AB allows only one scale signal per bar, when the
system scales out 2 or 3 times per bar, it is ok on the chart but
signals beyond first scaleout are not getting to the backtester.
2a-Are there plans to enhance AB with scale1[bar],...,scale4[bar]
arrays beyond the actual buy[bar],sell[bar],short[bar],cover[bar] with
all its backtest implications?
2b-To move forward now and backtest multiple scaleout regardless of on
what bar it happen, one approach is to implement those arrays and code
custom GetFirstMSignal(bar), GetNextMSignal(bar), ... to place
synthetic bo.EnterTrade(), multiple bo.ScaleTrade() and bo.ExitTrade()
within the initialized backtester low level frame.
Would more than welcome any comment, guidance or suggestion you may
have on this topic.

Thanks again and best regards,
Fernando Martin


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> PreProcess has nothing to do with that.
> 
> I wrote you before: 
> 
> >> >
> >> > You can do that but only using custom backtester interface.
> >> > Regular backtester allows one scaleout or exit on single bar, not
> > both.
> >> >
> >> > This sample shows how to perform scaling using custom backtester
> >> > http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions
> >> > This is more general doc:
> 
> This means that if you want to scaleout and exit on the same bar
> you need to use 
> ScaleTrade
> and 
> Enter/ExitTrade
> on your own in custom backtester. This is is know as low-level
custom backtester.
> In this case you don't use signals from first phase at all. See this:
>
http://www.amibroker.org/userkb/2008/03/16/amibroker-custom-backtester-interface-2
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "martinfernando66" <clogs@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, March 20, 2008 3:39 PM
> Subject: [amibroker] Re: Backtester: same bar scaleout and sell
signals traced (2)
> 
> 
> > For the traces tried all SetBacktestMode parameters, including the new
> > ones 2.
> > Also traced the signals delivered by the system, which are ok.
> > Those signals get transformed by bo.PreProcess() if on the same bar,
> > altering
> > backtest postprocess while leaving positions open.
> > Since scaleout is removed,  to  software trap the signals on a custom
> > backtester  a workaround is required.
> > By chance, is there an undocumented 'transparent' backtester mode so
> > that PreProcess leaves signals
> > untouched for the custom backtester?
> > Thanks again.
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "martinfernando66" <clogs@> wrote:
> >>
> >> Tomasz:
> >> many thanks for your kind reply. Have just traced on DebugView with a
> >> simple signal viewer custom backtester several bars to see how and
> >> what signals appear. No processing at all done in the custom
> >> backtester code below.
> >> The trace shows signals on 30 min bars in accordance with the chart.
> >> Switching to 1 hour bars, the chart shows signals but no signals are
> >> appearing on the backtester trace in some cases, as attached
below. In
> >> some others, scaleout signals (6) get changed to buy signals (1)
or to
> >> short signals (3) depending on the trade side. Positions remain open
> >> although posSize is 0 (-1000000).
> >> Am I missing something important? bo.PreProcess() appears to change
> >> and remove signals. How do you suggest I shall move forward in custom
> >> backtesting scaleout and sell signals on the same bar?
> >>
> >> Thank you for your advice since at this point I'm a bit lost.
> >> Best regards,
> >> Fernando Martin
> >>
> >> 30 min trace:
> >> [2124] bar=144 080318,125900
> >> [2124] bar=145 080318,132900
> >> [2124] bar=146 080318,135900
> >> [2124] bar=147 080318,142900
> >> [2124] bar=148 080318,145900
> >> [2124] bar=149 080318,152900
> >> [2124] bar=150 080318,155900
> >> [2124] bar=151 080318,162900
> >> [2124] Type=1, Price=1311.750, posSize=-2002
> >> [2124] bar=152 080318,165900
> >> [2124] Type=6, Price=1312.500, posSize=-2001
> >> [2124] bar=153 080318,172900
> >> [2124] bar=154 080318,175900
> >> [2124] bar=155 080318,182900
> >> [2124] bar=156 080318,185900
> >> [2124] bar=157 080318,192900
> >> [2124] Type=2, Price=1317.750, posSize=-10000000000
> >> [2124] bar=158 080318,195900
> >> [2124] bar=159 080318,202900
> >> [2124] bar=160 080318,205900
> >> [2124] bar=161 080318,212000
> >> [2124] Type=1, Price=1334.250, posSize=-2002
> >> [2124] bar=162 080318,215900
> >> [2124] bar=163 080318,222900
> >> [2124] Type=2, Price=1333.250, posSize=-10000000000
> >> [2124] bar=164 080318,232900
> >> [2124] bar=165 080318,235900
> >> [2124] bar=166 080319,002900
> >> [2124] bar=167 080319,005900
> >>
> >> 60 min. trace:
> >> [2124] bar=220 080318,125900
> >> [2124] bar=221 080318,135900
> >> [2124] bar=222 080318,145900
> >> [2124] bar=223 080318,155900
> >> [2124] bar=224 080318,165900
> >> [2124] bar=225 080318,175900
> >> [2124] bar=226 080318,185900
> >> [2124] bar=227 080318,195900
> >> [2124] bar=228 080318,205900
> >> [2124] bar=229 080318,215900
> >> [2124] bar=230 080318,222900
> >> [2124] bar=231 080318,235900
> >> [2124] bar=232 080319,005900
> >>
> >> Custom backtester code:
> >> if(Status("action") == actionPortfolio){
> >> bo = GetBacktesterObject();      bo.PreProcess();
> >> // debug initialize bar date-time
> >> dn = DateNum();
> >> tn = TimeNum();
> >>
> >> for(bar=0; bar<BarCount; bar++){
> >>
> >> // debug bar number, date, time
> >> _TRACE(StrFormat("bar=%1.0f %06.0f,%06.0f\n", bar ,dn[bar]%
> >> 1000000,tn[bar]));
> >>
> >> // explore signals in bar
> >> for( sig=bo.GetFirstSignal(bar); sig; sig=bo.GetNextSignal(bar) ){
> >>
> >> // debug signals
> >> _TRACE(StrFormat("Type=%1.0f, Price=%4.3f, posSize=%2.0f\n",
sig.Type,
> >> sig.Price, sig.PosSize));
> >>
> >> }
> >> bo.ProcessTradeSignals(bar);
> >>        bo.UpdateStats(i, 1);
> >>        bo.UpdateStats(i, 2);
> >> }
> >>  bo.PostProcess();
> >>
> >> }
> >>
> >> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" groups@ wrote:
> >> >
> >> > Hello,
> >> >
> >> > You can do that but only using custom backtester interface.
> >> > Regular backtester allows one scaleout or exit on single bar, not
> > both.
> >> >
> >> > This sample shows how to perform scaling using custom backtester
> >> > http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions
> >> > This is more general doc:
> >> >
> >>
> >
http://www.amibroker.org/userkb/2008/03/16/amibroker-custom-backtester-i\
> > nterface-2
> >> >
> >> > Best regards,
> >> > Tomasz Janeczko
> >> > amibroker.com
> >> > ----- Original Message -----
> >> > From: "martinfernando66" clogs@
> >> > To: amibroker@xxxxxxxxxxxxxxx
> >> > Sent: Tuesday, March 18, 2008 12:56 PM
> >> > Subject: [amibroker] Backtester: same bar scaleout and sell signals
> >> >
> >> >
> >> > > Coded a system that is flexible to take profit (Buy=scaleout) and
> > exit
> >> > > on the same bar (sell=3) if conditions are met.
> >> > > After several tries with different periodicity (15 min, 30 min, 1
> >> > > hour) appears that backtester is not processing more than one
> > signal
> >> > > per bar, leaving open the position while on the chart the system
> > is
> >> > > closing it.
> >> > > Missed some setting? If not, would be very grateful if someone
> > could
> >> > > confirm if standard backtester is only processing one signal per
> > bar.
> >> > > Thanks,
> >> > > Fernando Martin
> >> > >
> >> > >
> >> > >
> >> > > ------------------------------------
> >> > >
> >> > > 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
> > 
> > 
> >
>



------------------------------------

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/