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

Re: [amibroker] Re: setforeign bug



PureBytes Links

Trading Reference Links

Hello,

Well, your data sample clearly shows misalignment:

QQQ:
>> 12/23/2003,1315,35.60,36.02,35.53,35.84,67060700,0

AAPL:
>> 12/23/2003,1300,19.92,19.95,19.60,19.81,5509189,0


As you can see time stamp for both is DIFFERENT (13:15 vs 13:00)
and this causes the problem you have.
So it IS MISALIGNMENT problem indeed.

The simplest way to overcome data alignment problem you are experiencing,
go to Tools->Preferences, "INTRADAY" tab,.
Switch "Time stamp of compressed intraday bars show" to
"END time of interval"
and UNCHECK "Override: weekly.... bars use day of last trade".

The other method would be setting Session Start and End
time correctly in File->Database Settings->Intraday and turning
on filtering data to the day session only.

Third method is using EOD database instead ("Base time interval" set to EOD).

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "k_binder_" <k_binder_@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, October 06, 2004 6:39 PM
Subject: [amibroker] Re: setforeign bug


> 
> 
> I did better than run purify, I created a PURE database from scratch.
> 
> If you want to help, do what I did and see if the results are the 
> same for you. If they are, something is wrong and I need to be aware 
> of why because I put money on the line based on the results of these 
> scans. 
> If you dont know the details of the discussion or ways to 
> troubleshoot and debug software problems, dont get in the middle of 
> it. you are only distracting from the issue, not helping.
> 
> thanks,
> ken
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@xxxx> wrote:
>> You don't mention that you actually did run the purify tool and 
> look at the
>> report. If you didn't why the hell not? PLEASE do what TJ asks you 
> to do!! 
>>  
>> d
>> 
>> 
>>   _____  
>> 
>> From: k_binder_ [mailto:k_binder_@x...] 
>> Sent: Wednesday, October 06, 2004 11:28 AM
>> To: amibroker@xxxxxxxxxxxxxxx
>> Subject: [amibroker] Re: setforeign bug
>> 
>> 
>> 
>> Tomasz,
>> It is NOT misaligned data. Here is what I did to test this 
> hypothesis:
>> 
>> I created a new database, imported 2 symbols into it with data 
>> starting from 12/24/2003 to 1/29/2004. This range is easily 
>> verifiable with the naked eye. There are NO missing days, NO 
>> misalignments. I can see that from the charts. I also checked the 
>> data in notepad before I imported into AB.
>> 
>> Next, I ran the exploration after selecting qqq. qROC was 
> calculated 
>> starting from the 4th bar, which is correct because the formula is 
>> qROC = ROC(close, 3);
>> 
>> Next, I selected aapl and ran this same exploration. The qROC was 
>> calculated starting from the 5th bar, which is WRONG since there is 
>> data from 12/24/2004 for aapl. This is exactly what I see when I 
> load 
>> all the data, the formula is shifted by 1 bar.
>> 
>> here are the files of data and results that I used:
>> 
>> qqq:
>> 12/23/2003,1315,35.60,36.02,35.53,35.84,67060700,0
>> 12/24/2003,1315,35.84,36.02,35.80,35.90,44840300,0
>> 12/26/2003,1315,35.96,36.09,35.82,35.85,25499000,0
>> 12/29/2003,1315,36.03,36.53,36.02,36.44,63456000,0
>> 12/30/2003,1315,36.53,36.58,36.30,36.56,48282100,0
>> 12/31/2003,1315,36.60,36.64,36.25,36.46,60531500,0
>> 01/02/2004,1315,36.65,36.79,36.22,36.36,55263700,0
>> 01/05/2004,1315,36.60,37.16,36.56,37.09,69757000,0
>> 01/06/2004,1315,37.08,37.42,36.95,37.34,60075300,0
>> 01/07/2004,1315,37.28,37.68,37.07,37.68,71895800,0
>> 01/08/2004,1315,37.87,38.00,37.60,37.98,78268200,0
>> 01/09/2004,1315,37.71,38.35,37.59,37.73,94326896,0
>> 01/12/2004,1315,37.85,38.35,37.68,38.33,77719504,0
>> 01/13/2004,1315,38.27,38.36,37.60,37.95,93060896,0
>> 01/14/2004,1315,38.08,38.25,37.84,38.08,69074400,0
>> 01/15/2004,1315,37.93,38.46,37.63,38.18,104597104,0
>> 01/16/2004,1315,38.38,38.63,38.17,38.57,77371600,0
>> 01/20/2004,1315,38.73,38.85,38.31,38.54,82083600,0
>> 01/21/2004,1315,38.39,38.66,38.00,38.38,112316800,0
>> 01/22/2004,1315,38.55,38.69,38.06,38.15,90966400,0
>> 01/23/2004,1315,38.21,38.46,37.78,38.01,88805504,0
>> 01/26/2004,1315,37.98,38.65,37.84,38.59,84703400,0
>> 01/27/2004,1315,38.51,38.63,37.69,37.74,97365800,0
>> 01/28/2004,1315,37.94,38.06,37.00,37.10,128169296,0
>> 01/29/2004,1315,37.24,37.31,36.66,37.24,144040496,0
>> 
>> aapl:
>> 12/23/2003,1300,19.92,19.95,19.60,19.81,5509189,0
>> 12/24/2003,1300,19.72,20.59,19.65,20.41,3169128,0
>> 12/26/2003,1300,20.35,20.91,20.34,20.78,1851614,0
>> 12/29/2003,1300,20.91,21.16,20.86,21.15,4168852,0
>> 12/30/2003,1300,21.18,21.50,21.15,21.28,3658351,0
>> 12/31/2003,1300,21.35,21.53,21.18,21.37,3115460,0
>> 01/02/2004,1300,21.55,21.75,21.18,21.28,2583378,0
>> 01/05/2004,1300,21.42,22.39,21.42,22.17,7060234,0
>> 01/06/2004,1300,22.25,22.42,21.71,22.09,9101133,0
>> 01/07/2004,1300,22.10,22.83,21.93,22.59,10481444,0
>> 01/08/2004,1300,22.84,23.73,22.65,23.36,8220176,0
>> 01/09/2004,1300,23.23,24.13,22.79,23.00,7641639,0
>> 01/12/2004,1300,23.31,24.00,23.10,23.73,8711348,0
>> 01/13/2004,1300,24.70,24.84,23.86,24.12,12126874,0
>> 01/14/2004,1300,24.40,24.54,23.78,24.20,11153762,0
>> 01/15/2004,1300,22.91,23.40,22.50,22.85,18185794,0
>> 01/16/2004,1300,23.00,23.04,22.61,22.72,6658609,0
>> 01/20/2004,1300,22.67,22.80,22.25,22.73,5642722,0
>> 01/21/2004,1300,22.70,22.97,22.43,22.61,4054951,0
>> 01/22/2004,1300,22.56,22.83,22.18,22.18,3660782,0
>> 01/23/2004,1300,22.42,22.74,22.25,22.56,4057256,0
>> 01/26/2004,1300,22.46,23.06,22.43,23.01,4845078,0
>> 01/27/2004,1300,23.03,23.25,22.80,23.07,5486319,0
>> 01/28/2004,1300,22.84,23.38,22.41,22.52,4917934,0
>> 01/29/2004,1300,22.63,22.80,22.19,22.68,379
>> 
>> qqq:
>> And here are the results:
>> Ticker               Date/Time                    QROC
>> qqqDailyTest      12/24/2003 13:15      
>> qqqDailyTest      12/26/2003 13:15      
>> qqqDailyTest      12/29/2003 13:15      
>> qqqDailyTest      12/30/2003 13:15      1.84
>> qqqDailyTest      12/31/2003 13:15      1.7
>> qqqDailyTest      1/2/2004 13:15      -0.22
>> qqqDailyTest      1/5/2004 13:15      1.45
>> qqqDailyTest      1/6/2004 13:15      2.41
>> qqqDailyTest      1/7/2004 13:15      3.63
>> qqqDailyTest      1/8/2004 13:15      2.4
>> qqqDailyTest      1/9/2004 13:15      1.04
>> qqqDailyTest      1/12/2004 13:15      1.73
>> qqqDailyTest      1/13/2004 13:15      -0.08
>> qqqDailyTest      1/14/2004 13:15      0.93
>> qqqDailyTest      1/15/2004 13:15      -0.39
>> qqqDailyTest      1/16/2004 13:15      1.63
>> qqqDailyTest      1/20/2004 13:15      1.21
>> qqqDailyTest      1/21/2004 13:15      0.52
>> qqqDailyTest      1/22/2004 13:15      -1.09
>> qqqDailyTest      1/23/2004 13:15      -1.38
>> qqqDailyTest      1/26/2004 13:15      0.55
>> qqqDailyTest      1/27/2004 13:15      -1.07
>> qqqDailyTest      1/28/2004 13:15      -2.39
>> qqqDailyTest      1/29/2004 13:15      -3.5
>> 
>> aapl:
>> Ticker               Date/Time      QROC
>> aaplDailyTest      12/24/2003 13:00      
>> aaplDailyTest      12/26/2003 13:00      
>> aaplDailyTest      12/29/2003 13:00      
>> aaplDailyTest      12/30/2003 13:00      
>> aaplDailyTest      12/31/2003 13:00      1.84
>> aaplDailyTest      1/2/2004 13:00      1.7
>> aaplDailyTest      1/5/2004 13:00      -0.22
>> aaplDailyTest      1/6/2004 13:00      1.45
>> aaplDailyTest      1/7/2004 13:00      2.41
>> aaplDailyTest      1/8/2004 13:00      3.63
>> aaplDailyTest      1/9/2004 13:00      2.4
>> aaplDailyTest      1/12/2004 13:00      1.04
>> aaplDailyTest      1/13/2004 13:00      1.73
>> aaplDailyTest      1/14/2004 13:00      -0.08
>> aaplDailyTest      1/15/2004 13:00      0.93
>> aaplDailyTest      1/16/2004 13:00      -0.39
>> aaplDailyTest      1/20/2004 13:00      1.63
>> aaplDailyTest      1/21/2004 13:00      1.21
>> aaplDailyTest      1/22/2004 13:00      0.52
>> aaplDailyTest      1/23/2004 13:00      -1.09
>> aaplDailyTest      1/26/2004 13:00      -1.38
>> aaplDailyTest      1/27/2004 13:00      0.55
>> aaplDailyTest      1/28/2004 13:00      -1.07
>> aaplDailyTest      1/29/2004 13:00      -2.39
>> 
>> you can see that qROC for aapl is shifted by 1 bar.
>> 
>> here is the formula:
>> SetForeign("qqqDailyTest");
>> qROC = ROC(Close, 3);
>> RestorePriceArrays();
>> 
>> 
>> Filter = 1;
>> AddColumn(qROC, "QROC");
>> 
>> This is very important. Please take the time to test this yourself 
>> and tell me where I am making a mistake.
>> 
>> thanks,
>> ken
>> 
>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" 
> <amibroker@xxxx> 
>> wrote:
>> > Hello,
>> > 
>> > >
>> > > How can data be misaligned? no matter what the value of aapl, on
>> > > 1/2/2004, I expect qROC to be -.22 because it is calculated 
> based 
>> on
>> > > qqq data, not aapl.
>> > 
>> > Again - there is NO bug and the behaviour is correct (i.e. as 
>> documented)
>> > 
>> > Please do what I write. I am not brushing away.
>> > 
>> > So again:
>> > Please do read the documentation
>> >  http://www.amibroker.com/f?foreign
>> > 
>> > It says:
>> > "Foreign function synchronizes the data file
>> > you are referencing with the currently selected symbol.
>> > 
>> > Synchronization makes sure that EACH bar of FOREIGN data
>> > matches exactly with each bar of currently selected symbol.
>> > 
>> > So if DateNum() function returns 990503 for given bar
>> > then Close array represents the CLOSE of currently selected 
> symbol 
>> at May 3, 1999
>> > and Foreign("SYMBOL", "C") represents close of foreign symbol at 
>> May 3, 1999 TOO.
>> > 
>> > This is absolutely necessary because otherwise you won't be able
>> > to do ANY meaningful operations involving both selected symbol 
> and 
>> foreign symbol.
>> > 
>> > This also needed for the display so when you mark the quote with 
>> vertical
>> > line it will always match the date displayed regardless if you 
> use 
>> Foreign or not.
>> > 
>> > Please note that if you have data holes in currently selected 
>> symbol then in order to synchronize bars Foreign function will 
> remove
>> > bars that exist in Foreign symbol but do not exist in currently 
>> selected symbol."
>> > 
>> > 
>> > Now if you have misaligned QQQ and AAPL data in three last bars 
> you 
>> will GET
>> > DIFFERENT results of your qROC.
>> > 
>> > So AGAIN PLEASE
>> > Go to Tools->Database Purify, enter QQQ as reference symbol and
>> > click "ANALYSE" and you will see.
>> > 
>> > Best regards,
>> > Tomasz Janeczko
>> > amibroker.com
>> > ----- Original Message ----- 
>> > From: "k_binder_" <k_binder_@xxxx>
>> > To: <amibroker@xxxxxxxxxxxxxxx>
>> > Sent: Wednesday, October 06, 2004 4:13 PM
>> > Subject: [amibroker] Re: setforeign bug
>> > 
>> > 
>> > >
>> > >
>> > > Tomasz,
>> > > Let me explain the situation again, in case you are just 
> brushing
>> > > this away as misaligned data again:
>> > > there are 2 data streams, qqq and aapl. (This happens with all 
>> nasdaq
>> > > 100 stocks for me).
>> > >
>> > > This is the formula:
>> > > SetForeign("qqq");
>> > >> > > qROC = ROC(Close, 3);
>> > >> > > RestorePriceArrays();
>> > >> > >
>> > >> > > Filter = 1;
>> > >> > > AddColumn(qROC, "QROC");
>> > >
>> > > when I "explore" this on qqq, I get a value of qROC=-.22 on 
>> 1/2/2004
>> > > when I "explore" this on aapl, qROC on the bar after 1/2/2004 
> is -
>> .22.
>> > >
>> > > How can data be misaligned? no matter what the value of aapl, on
>> > > 1/2/2004, I expect qROC to be -.22 because it is calculated 
> based 
>> on
>> > > qqq data, not aapl.
>> > >
>> > > I would appreciate a quick reply to this problem.
>> > >
>> > > ken
>> > >
>> > >
>> > > --- In amibroker@xxxxxxxxxxxxxxx, "k_binder_" <k_binder_@xxxx> 
>> wrote:
>> > >>
>> > >> tomasz,
>> > >> This happens not only with aapl but also with other stocks. I 
>> just
>> > >> gave you aapl as an example.
>> > >>
>> > >> I also use tradestation for intraday trading. I got the data 
> from
>> > >> tradestation and this same formula works fine with TS. 
> Ofcourse, 
>> I
>> > >> cannot test this at a portfolio level with TS, that's why I 
> want 
>> to
>> > >> use AB.
>> > >>
>> > >> ken
>> > >>
>> > >>
>> > >> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
>> > > <amibroker@xxxx>
>> > >> wrote:
>> > >> > Hello,
>> > >> >
>> > >> > There is no bug, simply your data is misaligned.
>> > >> > Check again because AAPL is for sure not updated to the same
>> > >> > data as QQQ.
>> > >> >
>> > >> > Please read the documentation
>> > >> > http://www.amibroker.com/f?foreign
>> > >> >
>> > >> > (about synchronizing arrays)
>> > >> >
>> > >> > Best regards,
>> > >> > Tomasz Janeczko
>> > >> > amibroker.com
>> > >> > ----- Original Message ----- 
>> > >> > From: "k_binder_" <k_binder_@xxxx>
>> > >> > To: <amibroker@xxxxxxxxxxxxxxx>
>> > >> > Sent: Wednesday, October 06, 2004 9:17 AM
>> > >> > Subject: [amibroker] setforeign bug
>> > >> >
>> > >> >
>> > >> > >
>> > >> > >
>> > >> > > I have a database with 2 stocks, qqq and aapl in it. Both 
> are
>> > >> daily
>> > >> > > data for 2004, upto 9/3/2004. My layout has both charts in 
>> it.
>> > >> > > I run the following code:
>> > >> > >
>> > >> > > SetForeign("qqq");
>> > >> > > qROC = ROC(Close, 3);
>> > >> > > RestorePriceArrays();
>> > >> > >
>> > >> > > Filter = 1;
>> > >> > > AddColumn(qROC, "QROC");
>> > >> > >
>> > >> > > I find that when I "explore" aapl with this 
> formula, "QROC" 
>> is
>> > >> > > shifted back 1 bar. like ref(qROC, -1) instead of qROC. 
> When 
>> I
>> > >> select
>> > >> > > qqq, everything is properly aligned.
>> > >> > >
>> > >> > > Has anyone experienced this?
>> > >> > >
>> > >> > > Any help will be appreciated.
>> > >> > > thanks,
>> > >> > > ken
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > > 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
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > 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
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > >
>> 
>> 
>> 
>> 
>> 
>> Check AmiBroker web page at:
>> http://www.amibroker.com/
>> 
>> Check group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
>> 
>> 
>> 
>> Yahoo! Groups Sponsor 
>> 
>> ADVERTISEMENT
>>  
>> 
> <http://us.ard.yahoo.com/SIG=129l48c5d/M=295196.4901138.6071305.300117
> 6/D=gr
>> 
> oups/S=1705632198:HM/EXP=1097162979/A=2128215/R=0/SIG=10se96mf6/*http:
> //comp
>> anion.yahoo.com> click here 
>>  
>> <http://us.adserver.yahoo.com/l?
> M=295196.4901138.6071305.3001176/D=groups/S=
>> :HM/A=2128215/rand=965840216> 
>> 
>> 
>>   _____  
>> 
>> 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
>> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
>>   
>> 
>> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service
>> <http://docs.yahoo.com/info/terms/> . 
>> 
>> 
>> 
>> 
>> [Non-text portions of this message have been removed]
> 
> 
> 
> 
> 
> 
> 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 --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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