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

[amibroker] Re: Backtesting Within Defined Historical Dates


  • Date: Tue, 29 Dec 2009 09:29:48 -0000
  • From: "jollypolly999" <jollypolly999@xxxxxxxxx>
  • Subject: [amibroker] Re: Backtesting Within Defined Historical Dates

PureBytes Links

Trading Reference Links



Mike, that is the winner. :p  Thankyou so much.  I wish you well and hope I can help out in some way.


--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
Jolly,
 
 You can't override the range dates once you're already being executed.
 It's a chicken and egg thing. However, if you include conditional logic
 to only accept signals during specific periods, then you can run the
 backtest over the a timeframe that includes all periods and the code
 will prevent trading except during allowed periods.
 
 e.g. Trade only during 2003 and 2005, vertical bars over green squares
 will be accepted, others will be ignored.
 
 Dates = DateNum();
 ValidDates = (Dates >= 1030101 && Dates <= 1031231) || (Dates >= 1050101
 && Dates <= 1051231);
 
 MyBuySignal = Cross( MACD(), 0 );
 Buy = MyBuySignal AND ValidDates;
 
 MySellSignal = Cross( 0, MACD());
 Sell = MySellSignal AND ValidDates;

> DateColors = IIF(ValidDates, colorGreen, 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;
 
 Alternatively, have a look at BatMan in the Files section of this group
 and write a batch script to run your backtests over each of the desired
 periods.
 
Mike
 
 
 


__._,_.___


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

__,_._,___