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

[amibroker] data padding, bar index in backtester, force stops in rotational backtesting



PureBytes Links

Trading Reference Links

Hello,

I think I may have found a solution to the previously post padding
problem, but I would like to have your input/comment on it and related
issues.
 
I use the longest history symbol (or a faked one with data for every
bar as suggested somewhere else in the post) as current, so barcount
takes its value, and then loop through my list and import using
foreign with default padding setting, so it should padd to the current
symbol, and I then export data with my own routines.
This should be equivalent to do a scan with reference symbol option in
scan setting and exporting (without the need of using foreign).
1)Can you confirm the two approaches should be equivalent?
2)Can I set the current symbol from AFL or it must be done "manually"?

But a new problem has arisen now: when I _trace the bar number in the
custom backtester loop I realized it varies only from 1 to N, where N
is the last number of bars over with I am backtesting (from backtester
settings).
This is quite puzzling since "real" absolute array index should go
from barount-N to barcount.
The thing gets worst when I choose a range of type from date to date
because then the "absolute" index range is even less guessable.
3)How can I now the real absolute bar range used in the custom backtester?
This is essential if I want to make sure I am accessing to the right
previously exported data, which is all indexed only via bar number.
For the moment I am thinking of just using PosScore property of the
signal object to store the info I need, since one field is enough, but
in general I would like to know how the bar indexing work at backtest
level.

4)One last question : is there a way to force stops (bar and
stop/profit types)  in rotational backtesting mode?
Are entry/exit price settable? (I have already post on this earlier,
basically I seem not to be able to control fully both entry/exit price
in rotational mode)
The reason why I ask it is because according to the user notes stops
are ignored in this mode, so this is why I am re-implementing my own
rotational/ranking system to allow them. 

Thanks
Ly
 

--- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
<loveyourenemynow@xxx> wrote:
>
> Thank you Tomasz, as usual AB has the seeting already there somewhere.
> 
> I am exporting data, and to do that I need to dimension an external
> array to the Barcount, and I have noticed that at least at indicator
> level this has different values for different symbols.
> This seems to mean that barcount is not the same of all symbols but
> varies from symbol to symbol, so I should first padd each symbol to
> the reference symbol at indicator level and then export (making sure
> the reference is the one with longer history, if it is not how does
> the padding deal with it?), otherwise the exported data will be out of
> sync.
> 
> Ho can I do that?
> Since this setting is present in backtest mode, could I scan through
> all the symbols once with the padding to reference symbol and this
> would make sure Barcount is the same for all symbols?
> 
> I want ot obtain the same result at indicator level instead of
> backtesting what should I do?
> 
> Another problem I encounter is that exporting vectors of barcount
> length is too memory consuming especially when I only backtest over
> the last 10% for example.
> Backesting loops through 1 to barcount anyway, even if I backtest over
> the last 10 % bars according to your explanation.
> Can I "manually" change the range of bars in the customized
> backtesting to the portion I want so I dont use too much memory?
> Would the same owrk also in scan mode?
> Or as a simple trick, can I "simulate" a smaller barcount so I only
> work on the postion of bars I really need?
> I think this could be achieved if the backtester had an option to work
> from bar n1 to bar n2 , similar to from date to date. 
> 
> 
> Thank again
> 
> Ly
> 
> >
> > Hello,
> > 
> > The Foreign function has the parameter that decides if it fills gaps
> > with nulls or with previous value. Use the default if you want
> previous values.
> > 
> > Indicators use QuickAFL, but AA does not (at the moment), so for
> backtest
> > you don't need to worry about quickafl at all.
> > You can turn off quickafl in indicators if you wish using
> SetBarsRequired function.
> > 
> > All loops that go throgh all bars should always use bars from 0 to
> BarCount - 1 regardless of when
> > there are run and regardless of quickafl.
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: "loveyourenemynow" <loveyourenemynow@>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Friday, January 11, 2008 10:09 AM
> > Subject: [amibroker] Re: IQ data holes for illiquid symbols in
> portofolio backtesting
> > 
> > 
> > > Thank you Tomasz.
> > > 
> > > I tried that but I seems to get empty values instead of the
previous.
> > > I use foreign
> > > Does the padding work also for the cusomized portion of the
backtest?
> > > Then I loop through the bars I get empty value for an index for
which
> > > data should exist. I am backtesting using only the last n days in 1
> > > minute mode, and I noticed that array[20] gives different values for
> > > different selected bar in the indicator pan, same code.
> > > I than found in the help:
> > > 
> > > When QuickAFL is ON, the BarIndex() may not be equal with array item
> > > index.
> > > 
> > > Actual array item 
> > > corresponding to bar index can be found this way:
> > > 
> > > bi = BarIndex();
> > > arrayitem = SelectedValue( bi ) - bi[ 0 ]; 
> > > "Close at selected bar:" + Close[ arrayitem ];
> > > 
> > > so should I do the same in the custom backtesting, or it takes
care of
> > > it automatically?
> > > 
> > > Or may be the customized backtesting should loop not between 1 and
> > > barcount but (barcount- numer of last quotations) and barcount?
> > > 
> > > Thanks
> > > Ly
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
> > >>
> > >> Hello,
> > >> 
> > >> In AA there is a "Pad and align to reference symbol" option
> > > (settings screen) that takes care of it.
> > >> http://www.amibroker.com/guide/w_settings.html
> > >> 
> > >> Best regards,
> > >> Tomasz Janeczko
> > >> amibroker.com
> > >> ----- Original Message ----- 
> > >> From: "loveyourenemynow" <loveyourenemynow@>
> > >> To: <amibroker@xxxxxxxxxxxxxxx>
> > >> Sent: Thursday, January 10, 2008 10:13 PM
> > >> Subject: [amibroker] Re: IQ data holes for illiquid symbols in
> > > portofolio backtesting
> > >> 
> > >> 
> > >> > If the more liquid stock is the active symbol, AB fix the
> problem at
> > >> > least at indicator level from what I can see, but if the 
> active stock
> > >> > is the illiquid missing quotes one, also the liquid is on the
same
> > >> > time stamps but I am not sure if barnumber are consistent
> > >> > 
> > >> > I hope in backtesting at portolio level ... all the bar of
the most
> > >> > symbols are use
> > >> > 
> > >> > LY
> > >> > 
> > >> > --- In amibroker@xxxxxxxxxxxxxxx, "loveyourenemynow"
> > >> > <loveyourenemynow@> wrote:
> > >> >>
> > >> >> I have realized that IQ data skips bars for illiquid
> symbols(if there
> > >> >> is no trade I guess), so that c[i] and c[i+1] in minute time
> > > frame for
> > >> >> example could correspond to an actual time difference of 5
or even
> > >> >> more time.
> > >> >> If I backtest a portfolio this will imply that I am looking a
> > >> >> different times for different stocks depending on their data
> > >> > availability.
> > >> >> For example 
> > >> >> 
> > >> >> c[100] is at timenume()==132200 for sym1 
> > >> >> c[100] is at timenume()==132700 for sym2
> > >> >> 
> > >> >> timenum() is not valued on per symbol bases, so I wonder what
> does it
> > >> >> return when is called in these cases.
> > >> >> 
> > >> >> The consequence is that the backtesting would be totally
> unreliable.
> > >> >> Compressing data at longer time scales should fix, but still
> > > depending
> > >> >> on the liquidity I would not now at what scale to go, and I
am not
> > >> >> sure how IB would deal with compression in such a scenario.
> > >> >> 
> > >> >> Anybody had the same problem?
> > >> >> 
> > >> >> Thanks
> > >> >> Ly
> > >> >>
> > >> > 
> > >> > 
> > >> > 
> > >> > 
> > >> > 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/