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

[amibroker] Re: How to purchase specific symbols on specific dates for a backtest?



PureBytes Links

Trading Reference Links



You can do this by expressing the specific date as a DateNum then triggering a Buy/Sell/Short/Cover for a specific symbol Name when DateNum() == your date. You can hard code the dates in your script, or read them in from a file.

e.g.

// Convert specific dates (e.g. June 27, 2007 - July 16, 2007) to DateNum

myAABuyDate = ((
2007 - 1900) * 10000); // Year
myAABuyDate += (
6 * 100);              // Month
myAABuyDate +=
27;                     // Day

myAASellDate = ((
2007 - 1900) * 10000); // Year
myAASellDate += (
7 * 100);              // Month
myAASellDate +=
16;                     // Day

// Trade specific symbol for specific dates

SetTradeDelays(0, 0, 0, 0);

dates =
DateNum();

Buy = Name() == "AA" AND myAABuyDate == dates;
BuyPrice = Open;

Sell = Name() == "AA" AND myAASellDate == dates;
SellPrice = Open;

Plot(Close, "Price", colorDarkGrey, styleBar);
PlotShapes(shapeUpArrow * Buy, colorGreen);
PlotShapes(shapeDownArrow * Sell, colorRed);

Mike


--- In amibroker@xxxxxxxxxxxxxxx, "sicko_canadian" <manuj.aggarwal@xxx> wrote:
>
> A specific date. say I develop a system or purchase someone's system which just gives me market timing signals - I want to be able to test them using SPX or QQQQ or QLD/QID pairs.
>
> spider
>
> --- In amibroker@xxxxxxxxxxxxxxx, "droskill" droskill@ wrote:
> >
> > A specific date meaning a generalized date (aka first day of the month, first day of the week) or a specific date (aka 7/23/08)?
> >
> > The former I know you can do - the latter someone else will have to answer.
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "sicko_canadian" <manuj.aggarwal@> wrote:
> > >
> > > I want to be able to backtest certain strategies against 4,5 specific symbols.
> > >
> > > Say I want to purchase SPY on certain date. On getting another signal replace it with QID etc.
> > >
> > > Is that possible AmiBroker?
> > >
> > > Thanks
> > > Spider
> > >
> >
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___