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

RE: [amibroker] Re: Backtesting Market Timing Signals



PureBytes Links

Trading Reference Links

Hello Bill,

here is some code, it uses strings (advantage you can make them reusable
with StaticVarSetText()) it is not exactly what you want, but you can modify
the functions to convert dates to DateNum().

function getBuySignalString()
	{
	fh = fopen( "BuyDateString.txt", "r");
	if( fh )
		{
		BuyDateString= fgets( fh );
		fclose(fh);
		}
	return BuyDateString;
	}

function getSellSignalString()
	{
	fh = fopen( "SellDateString.txt", "r");
	if( fh )
		{
		SellDateString = fgets( fh );
		fclose(fh);
		}
	return SellDateString;
	}

BuyDateString = getBuySignalString();
SellDateString = getSellSignalString();
DateNumber = DateNum();
FirstBar = LastValue(ValueWhen(Status("firstbarinrange"),BarIndex()));
Buy=Sell=0;

for(b=FirstBar;b<BarCount;b++)
	{
	Buy[b] = StrFind( BuyDateString, NumToStr(DateNumber[b],1.0,False)) > 0;
	Short[b] = StrFind( SellDateString, NumToStr(DateNumber[b],1.0,False)) > 0;
	}

Plot(Buy,"BUY",5,2);
Plot(Short,"short",4,2);

Title = BuyDateString+"\n"+SellDateString;

-----Original Message-----
From: bilbo0211 [mailto:bilbod@xxxxxxxxxx]
Sent: Monday, March 07, 2005 3:12 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Backtesting Market Timing Signals



>>You should contact the author of the formula. I am not the autor.<<

I am the author of the formula. I am trying to evaluate Amibroker and
I selected what I thought was a simple problem. I put some timing
signals in a file, like this:

S,03/16/2004
B,04/01/2004
S,04/27/2004
B,06/07/2004

I could find no built in capability to deal with this simple situation
so I wrote my own formula.

>> printf output is written to:
- commentary window
- interpretation window. <<

I tried using printf statements for debugging but they generate no
output. I tried using _TRACE with debugview but it generates no output
either.

I am not a computer programmer but I do find it necessary to write
programs occasionally so I am not completely clueless. Unfortunately I
am coming to the conclusion that unless you can create your trading
strategies from built in functions, Amibroker is very difficult to use
primarily due to a lack of debugging capability.

Bill





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 other support material please check also:
http://www.amibroker.com/support.html




Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/

To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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