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

Re: [amibroker] Exploration AFL is causing AB to throw and exception



PureBytes Links

Trading Reference Links

Hello,

Scalars works fine in AddColumn, at least on my end.
There should be no problem with using scalars as they are automatically
upsized to arrays when needed.

Simple check:

Filter=1;
AddColumn(1,"test"); // scalars work fine


What may have give problems is that when your data consists of unlisted
symbols that don't have data for range begin and/or end.

I prepared artificial data that simulates symbol that stopped tradin in 1999
and when I run your formula with range selected in 2006 it generates exception.

Workaround is to exclude unlisted symbols from the exploration.
You may use Tools->Database Purify to detect such symbols

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Nick Busigin" <nick@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, March 05, 2007 1:09 AM
Subject: Re: [amibroker] Exploration AFL is causing AB to throw and exception


> Hi Tomasz,
> 
> Thanks for you quick reply...
> 
> FWIW, I put the AddColumn statements inside the if statement in a
> misguided attempt to eliminate the problem I was seeing.  Per your
> suggestion, I got rid of the if{} around the AddColumn() statements, but
> still have problems and AB is still throwing an exception.
> 
> Upon studying the manual some more, I discovered an error in my code
> which I think is the root of my problem.  ie. I am using a scalar
> variable as the first argument in one of the AddColumn()  statements
> instead of an array variable.  However, I do want to print out the
> scalar variable Pct_Change in the report.  Is there a way to convert the
> scalar Pct_Change variable into an array so I can use it in the
> AddColumn() function? 
> 
> Kind regards,
>                                    Nick
> 
> Here's my revised program which unfortunately still crashes AB:
> 
> ---- Script begins after this line -----
> /*
> * Scan for stocks in an Interval that have:
> *
> *  - a higher Close at the end of the interval than at the beginning of
> *    the interval
> *  - a price higher than 2 
> *  - a volume higher than 100,000 (based on bar at the beginning of the
> *    interval)
> *
> * NOTE:  YOU MUST SET THE BEGIN AND END MARKERS ON THE CHART BEFORE
> *        RUNNING THIS EXPLORATION.
> */
> 
> Ci = BeginValue(C);
> Cf = EndValue(C);
> Vi = BeginValue(V);
> Pct_Change  = 0;
> 
> if (Ci != 0)
>   Pct_Change = 100.0 * ( Ci - Cf )/ Ci;
> 
> C1 = (Pct_Change > 0.5);
> C2 = (Ci > 2) AND (Cf > 2);
> C3 = (Vi > 100000);
> 
> Filter = C1 AND C2 AND C3;
> 
> AddColumn( C, "Close" );
> AddColumn( Pct_Change, "Pct Change" );
> AddColumn( V, "Volume" );
> ---- Script ends before this line -----
> 
> 
> On Sun, 4 Mar 2007, Tomasz Janeczko wrote:
> 
>> AddColumn must NOT be put inside conditional statement.
>> So remove this:
>> if( Filter != 0 )
>> 
>> (AB automatically handles filtering so it is compeltely NOT necessary)
>> 
>> Simply: when everything fails READ THE MANUAL
>> http://www.amibroker.com/guide/h_exploration.html
>> 
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message ----- 
>> From: "Nick Busigin" <nick@xxxxxxxxx>
>> 
>> >I am trying to create an exploration which allows me to pick out stocks
>> > that meet a number of conditions over a customizable time interval.
>> > Here's my approach:
>> > 
>> > 1) Double Click in Chart to set begin and end markers.
>> > 2) Open Automatic Exploration window
>> > 3) Set Range to last n bars, with n=1
>> > 4) Pick Exploration AFL (shown below)
>> > 5) Click on Explore.
>> > 
>> > Unfortunately, I keep having AB throw an exception and ask me if I want
>> > to submit a bug report.  I have done so, but I also thought it worth
>> > asking the experienced AFL coders on this list what they may see that I
>> > am doing wrong.  Here's my AFL script:
>> > 
>> > ---- Script begins after this line -----
>> > /*
>> > * Scan for stocks in an Interval that have:
>> > *
>> > *  - a higher Close at the end of the interval than at the beginning of
>> > *    the interval
>> > *  - a price higher than 2 
>> > *  - a volume higher than 100,000 (based on bar at the beginning of the
>> > *    interval)
>> > *
>> > * NOTE:  YOU MUST SET THE BEGIN AND END MARKERS ON THE CHART BEFORE
>> > *        RUNNING THIS EXPLORATION.
>> > */
>> > 
>> > Ci = BeginValue(C);
>> > Cf = EndValue(C);
>> > Vi = BeginValue(V);
>> > 
>> > if (Ci != 0) {
>> >   Pct_Change = 100.0 * ( Ci - Cf )/ Ci;
>> > 
>> >   C1 = Pct_Change > 0.5;
>> >   C2 = Ci > 2 AND Cf > 2;
>> >   C3 = Vi > 100000;
>> > }
>> > else{
>> >   C1 = 0;
>> >   C2 = 0;
>> >   C3 = 0;
>> > }
>> > 
>> > Filter = C1 AND C2 AND C3;
>> > 
>> > if( Filter != 0 )
>> > {
>> >  AddColumn( C, "Close" );
>> >  AddColumn( Pct_Change, "Pct Change" );
>> >  AddColumn( V, "Volume" );
>> > }
>> > ---- Script ends above this line -------
>> > 
>> > Some of the conditional logic is in the code as an attempt to get around
>> > the problem I am running into.   Can anybody see what's causing the
>> > exception?
>> > 
>> > Kind regards,
>> >                                       Nick
>> > 
>> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> >                   Help fight the war against Spam;
>> >       Erase all addresses before forwarding any item of email.
>> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> 
> 
> 
> 
> 
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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