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

[amibroker] Re: Backtesting Within Defined Historical Dates


  • Date: Tue, 29 Dec 2009 07:38:58 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: Backtesting Within Defined Historical Dates

PureBytes Links

Trading Reference Links



Hi,

It's not that surprising that you would not get any signals. Your buy/sell criteria are very rigid. The Cross of the MACD would have to happen on exactly the dates that you specified, else your criteria would not be met. Also, I can't tell whether you've used a zero or the letter 'O' for the second argument to Cross. On my test symbol, using zero I get signals, using the letter 'O' (i.e. Open) I do not.

To help with debugging, use the following code. If you do not see a vertical green bar line up over top of a green square along the base, then your buy signal did not occur on a valid buy date. Likewise for selling, if a vertical red bar does not line up over top of a red square, then your sell signal did not line up over a valid sell date.

Dates = DateNum();

MyBuySignal =
Cross( MACD(), 0
);
ValidBuyDates = Dates ==
1030404
;
Buy = MyBuySignal AND
ValidBuyDates;

MySellSignal =
Cross( 0, MACD
());
ValidSellDates = Dates ==
1041105
;
Sell = MySellSignal AND
ValidSellDates;

DateColors =
IIF(ValidBuyDates, colorGreen, IIF(ValidSellDates, colorRed, colorLightGrey
));

Plot(1, "", DateColors, styleArea | styleOwnScale | styleNoLabel
);
Plot(MyBuySignal, "Buy Signal", colorGreen, styleHistogram, styleOwnScale
);
Plot(MySellSignal, "Sell Signal", colorRed, styleHistogram, styleOwnScale
);

Title = NumToStr(DateTime(), formatDateTime) + ", " + EncodeColor(colorGreen) + "Buy Signal: " + MyBuySignal + ", " + EncodeColor(colorRed) + " Sell Signal: " + MySellSignal;

Mike


--- In amibroker@xxxxxxxxxxxxxxx, "jollypolly999" <jollypolly999@xxx> wrote:
>
> Thanks mate. I added the buy and sell signals and only one date range to begin, with the backtester range setting on "all quotations" (only setting that produced a trade). There was one trade opened on the beginning 07/04/03 and closed at the end 08/11/04. No other buy/sell signals triggered during that date range. This is the arrangement example. Thanks so much anyway. :)
>
> Dates = DateNum();
> MyBuySignal = Cross( MACD(), O );
> ValidBuyDates = Dates == 1030404;
>
> Buy = MyBuySignal AND ValidBuyDates;
>
> Dates = DateNum();
> MySellSignal = Cross( 0, MACD());
> ValidSellDates = Dates == 1041105;
>
> Sell = MySellSignal AND ValidSellDates;
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" sfclimbers@ wrote:
> >
> > Try something like the following:
> >
> > Dates = DateNum();
> > MyBuySignal = ...;
> > ValidBuyDates = Dates == 1041105 OR Dates == ... OR Dates == ...;
> >
> > Buy = MyBuySignal AND ValidBuyDates;
> > ...
> >
> > Repeat the same for Sell.
> >
> > Mike
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "jollypolly999" <jollypolly999@> wrote:
> > >
> > > Greetings. I have spent several hours doing individual backtests within certain historical dates. For example my system will only enter the stock exchange if certain criteria are met. There are 10 seperate dates in which I switch the system on and off.
> > >
> > > So the question remains. Please, is it possible to add code to my formula so that the backtester only tests within the 10 seperate defined dates?
> > >
> > > I have tried adding the following code (an example) but the backtester over-rides it. Unless I need to tick something in the backtester.
> > >
> > > Buy = Buy OR (DateNum() == 1030404); which is 04/04/03
> > > Sell = Sell OR (DateNum() == 1041105); which is 05/11/04
> > >
> >
>



__._,_.___


**** 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

__,_._,___