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

[amibroker] Re: Backtesting Market Timing Signals



PureBytes Links

Trading Reference Links



--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
Note: I still cannot figure out how to view the printf output?

I changed the incorrect line and now get this error
---
Line 59, Column 14:
}

Buy=Sell=Short=Cover=0;

getSignalDates("d:\\my programs\\amibroker\\fssignals");
-------------------------------------------------------^

Error 6.
Array subscript has to be a number
---

Bill

> Of course not. Single backslash in AFL must be written as \\
> 
> Example:
> 
> "C:\\Program Files\\AmiBroker\\Formulas\\MyFormula.afl"
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Graham" <kavemanperth@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, March 07, 2005 9:18 AM
> Subject: Re: [amibroker] Backtesting Market Timing Signals
> 
> 
> > 
> > Is this lne correct?
> > ( "d:/my\ programs/amibroker\fssignals");
> > 
> > 
> > On Mon, 07 Mar 2005 00:27:49 -0000, bilbo0211 <bilbod@xxxx> wrote:
> >> 
> >> 
> >> I downloaded the Amibroker Demo and I am trying to backtest market
> >> timing signals.
> >> 
> >> I put the buy/sell dates in a csv file and am trying to read it
in and
> >> convert it into buy/short arrays. I have not been very successful.
> >> 
> >> I cannot see my printf out output because I cannot figure out how to
> >> display the output window.
> >> 
> >> The code is below.
> >> 
> >> Bill
> >> 
> >> function Date_To_Num(mm_dd_yyyy)
> >> {
> >>  mm_ = StrToNum(StrLeft(mm_dd_yyyy,2));
> >>  dd_ = StrToNum(StrMid(mm_dd_yyyy,3,2));
> >>  yy_ = StrToNum(StrRight(mm_dd_yyyy,4));
> >>  Date_Num = (10000 * (yy_ - 2000)) + (100 * mm_) + dd_;
> >>  RESULT = Date_Num;
> >>  return RESULT;
> >> }
> >> 
> >> procedure getSignalDates( filename)
> >> {
> >>  fh = fopen( filename, "r");
> >>  if( fh )
> >>  {
> >>    while( ! feof( fh ) )
> >>    {
> >>      s=fgets(fh);
> >>      Index = ValueWhen( DateNum() == Date_To_Num(StrExtract( s,1 )),
> >> BarIndex(), 1);
> >>      sig=StrExtract( s,0 );
> >>      if( sig == "B")
> >>      {
> >>        Buy[Index]=1;
> >>        Cover[Index]=1;
> >>      }
> >>      else
> >>      {
> >>        if( sig == "S")
> >>        {
> >>          Short[Index]=1;
> >>          Sell[Index]=1;
> >>        }
> >>        else
> >>        {
> >>          if( sig == "C")
> >>          {
> >>            Sell[Index]=1;
> >>            Cover[Index]=1;
> >>          }
> >>          else
> >>          {
> >>            printf( "ERROR in %s/n", filename );
> >>          }
> >>        }
> >>      }
> >>    }
> >>  }
> >>  else
> >>  {
> >>  printf("ERROR: file can not be found (does not exist)");
> >>  }
> >> }
> >> 
> >> Buy=Sell=Short=Cover=0;
> >> getSignalDates( "d:/my\ programs/amibroker\fssignals");
> >> for( i=0; i<BarCount; i++)
> >> {
> >>  printf("%d",Buy[i]);
> >> }
> >> 
> >> 
> >> Check AmiBroker web page at:
> >> http://www.amibroker.com/
> >> 
> >> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >> Yahoo! Groups Links
> >> 
> >> 
> >> 
> >> 
> >> 
> > 
> > 
> > -- 
> > Cheers
> > Graham
> > http://e-wire.net.au/~eb_kavan/
> > 
> > 
> > 
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> > 
> > Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >








------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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/