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

Re: [amibroker] Re: Data cleansing / cleaning - removing bars



PureBytes Links

Trading Reference Links

Hello,

No, you don't understand. The prices (Open High Low Close) must NOT be NULL. Period.

All bars need to have known prices because all values are used for equity calculation, even if there are no signals at given bar.

If you want to clean your data - DO IT FIRST. Clean it BEFORE doing anything more. If you want to remove
bars - use Quote Editor.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "only_accept_the_real_thing" <oman002@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, August 22, 2009 12:57 AM
Subject: [amibroker] Re: Data cleansing / cleaning - removing bars


> Tomasz,
>
> Thankyou for your reply. I am familiar with what a NULL is. What I am not familiar with is whether the way NULL is handled by the
> backtester is as expected or not. From your response, it sounds like the backtester is treating NULLs as it should - ie: as an
> unknown value that it cannot process and so stops. I am surprised it is treated this way because this is different from the way
> NULL is treated in a comparison statement:
>
> eg: L <= LongStopLossLevel will return TRUE if L is Null
>
> In this case the statement does not die, like the backtester, but returns a TRUE value. This behaviour is different again from
> most other programming languages (eg: SQL, Java, C) which would return FALSE or produce a runtime exception if NULL were compared
> to a value.
>
> As I said in my first post, my overall goal is to clean my data without having to modify the symbol source. The bad bars in my
> data are those that have O==H==L==C==V. I would like to
>
> 1) ignore these bars in the signal generation parts of my AFL Code. This I can do if I set them to NULL.
>
> 2) for the backtester to ignore these bars if I have a position on when it encounters such a bar.
>
> From your response I now know that the expected behaviour of the backtester is to die when a position is on and it encounters a
> NULL value in a bar. I can easily get around this by doing the following in the AFL code:
>
> -Backup the O, H, L, C arrays
> -Clean data by setting O, H, L, C to NULL for bad bars
> -Generate signals using cleaned O, H, L, C. Be aware that the cleaned arrarys contain some NULLs and when a NULL is used in a
> comparison statement it will return true
> -Restore O,H,L,C to the backed up copies. This is to make the backtester happy.
>
> Regards
>
>> >> > > >
>> >> > > > If possible I would not like to modify the source data files, but ignore these bars in the AFL code for my system. I've
>> >> > > > tried the
>> >> > > > following in the AFL code to no avail:
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>>
>> Hello,
>>
>> Apparently you don't know what Null means.
>> Null means UNDEFINED or UNKNOWN.
>> Obviously with UNKNOWN prices performing backtest does not make any sense, does it ?
>>
>> It would help if you actually described in plain english, what you really want to achieve, because
>> right now it does not make any sense. You simply can not set data to NULL (unknown) and expect any results.
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message ----- 
>> From: "only_accept_the_real_thing" <oman002@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Tuesday, August 18, 2009 11:04 AM
>> Subject: [amibroker] Re: Data cleansing / cleaning - removing bars
>>
>>
>> > O, H, L and C are succesfully being set to Null, but it looks like the backtester doesn't like the Null. If I initiate a
>> > position
>> > on the bar before a BadBar, when the Backtester tries to evaluate the position on the BadBar it stops and prints a loss of $2.5
>> > billion! Is this as expected, or is this a bug?
>> >
>> > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
>> >>
>> >> You could also have just captured the scenario in a variable and kept your original code, except operating on the variable
>> >> instead of repeating the test over and over again.
>> >>
>> >> e.g.
>> >>
>> >> BadBar = (O == H AND O == L AND O == C AND O == Volume);
>> >>
>> >> Open = IIf(BadBar, Null, O);
>> >> Close = IIf(BadBar, Null, C);
>> >> High = IIf(BadBar, Null, H);
>> >> Low = IIf(BadBar, Null, L);
>> >>
>> >> That would save you from making redundant IsNull function calls.
>> >>
>> >> Mike
>> >>
>> >> --- In amibroker@xxxxxxxxxxxxxxx, "only_accept_the_real_thing" <oman002@> wrote:
>> >> >
>> >> > Thankyou Tomasz and Graham, that works!
>> >> >
>> >> > Because the Open has been changed to Null after the first statement (if O==H==L==C==Volume) then O == H will be false so
>> >> > I've
>> >> > had to check for this in subsequent statements. The working code is:
>> >> >
>> >> > Open = IIf(O == H AND O == L AND O == C AND O == Volume, Null, O);
>> >> > Close = IIf(IsNull(O), Null, C);
>> >> > High = IIf(IsNull(O), Null, H);
>> >> > Low = IIf(IsNull(O), Null, L);
>> >> >
>> >> > Many thanks!
>> >> >
>> >> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
>> >> > >
>> >> > > Hello,
>> >> > >
>> >> > > Common coding mistake. You are using assignment (=) instead of comparision (==))
>> >> > >
>> >> > > Should be:
>> >> > > Open = IIf(O == H AND O == L AND O == C AND O == Volume, Null, O);
>> >> > >
>> >> > > Best regards,
>> >> > > Tomasz Janeczko
>> >> > > amibroker.com
>> >> > > ----- Original Message ----- 
>> >> > > From: "only_accept_the_real_thing" <olivermannion@>
>> >> > > To: <amibroker@xxxxxxxxxxxxxxx>
>> >> > > Sent: Saturday, August 15, 2009 2:08 AM
>> >> > > Subject: [amibroker] Data cleansing / cleaning - removing bars
>> >> > >
>> >> > >
>> >> > > > Hi there,
>> >> > > >
>> >> > > > I posted this intially to amibroker-afl but it doesn't appear to have been moderated and there's not much activity over
>> >> > > > there so
>> >> > > > I've reposted here.
>> >> > > >
>> >> > > > What I would like to do is remove bars from my symbol that have open = high = low = close = volume.
>> >> > > >
>> >> > > > If possible I would not like to modify the source data files, but ignore these bars in the AFL code for my system. I've
>> >> > > > tried the
>> >> > > > following in the AFL code to no avail:
>> >> > > >
>> >> > > > Open = IIf(O = H AND O = L AND O = C AND O = Volume, Null, O);
>> >> > > > Close = IIf(O = H AND O = L AND O = C AND O = Volume, Null, C);
>> >> > > > High = IIf(O = H AND O = L AND O = C AND O = Volume, Null, H);
>> >> > > > Low = IIf(O = H AND O = L AND O = C AND O = Volume, Null, L);
>> >> > > >
>> >> > > > Any help would be much appreciated! Thankyou!
>> >> > > >
>> >> > > >
>> >> > > >
>> >> > > > ------------------------------------
>> >> > > >
>> >> > > > **** 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/
>> >> > > >
>> >> > > > Yahoo! Groups Links
>> >> > > >
>> >> > > >
>> >> > > >
>> >> > >
>> >> >
>> >>
>> >
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > **** 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/
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>>
>
>
>
>
> ------------------------------------
>
> **** 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/
>
> Yahoo! Groups Links
>
>
>



------------------------------------

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

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/