Thanks again, it does work. I missed the fact that I was not compressing the datetime array. I was just compressing closing price to monthly.
From: [email protected] [mailto:[email protected]] On Behalf Of Anthony Faragasso Sent: Sunday, February 21, 2010 1:43 PM To: [email protected] Subject: Re: [amibroker] Associating the correct date with barindex This worked for me...I changed the ticker to test it..opened log window and turned on Internal trace ... TimeFrameSet( inMonthly ); dt = DateTime(); SetForeign( "S" ); Eq = Close; TimeFrameRestore(); for ( i = 0 ; i < BarCount ; i++ ) { nt = ValueWhen(Eq[i], dt); _TRACE( "i: " + i + " Date: " + NumToStr( nt[i], formatDateTime ) + " Eq: " + Eq[i] ); ----- Original Message ----- From: ta <mailto:[email protected]> To: [email protected] Sent: Sunday, February 21, 2010 4:16 PM Subject: RE: [amibroker] Associating the correct date with barindex Thanks for your reply . It does not seem to work for me. The following is the code: dt = DateTime(); SetForeign( "~~~Equity" ); TimeFrameSet( inMonthly ); Eq = Close; for ( i = 0 ; i < BarCount ; i++ ) { nt = ValueWhen(Eq[i], dt[i]); _TRACE( "i: " + i + " Date: " + NumToStr( nt[i], formatDateTime ) + " Eq: " + Eq[i] ); } From: [email protected] [mailto:[email protected]] On Behalf Of Anthony Faragasso Sent: Sunday, February 21, 2010 6:04 AM To: [email protected] Subject: Re: [amibroker] Associating the correct date with barindex Something like: Valuewhen(eg[i],dt); ----- Original Message ----- From: ta <mailto:[email protected]> To: [email protected] Sent: Saturday, February 20, 2010 7:13 PM Subject: [amibroker] Associating the correct date with barindex Can somebody please tell me how I can associate the correct date with barindex when data is compressed? In the following example I am compressing the closing price of equity curve to monthly. However the trace statement shows incorrect date for the monthly prices.TIA dt = DateTime(); SetForeign( "~~~Equity" ); TimeFrameSet( inMonthly ); Eq = Close; for ( i = 0 ; i < BarCount ; i++ ) { _TRACE( "i: " + i + " Date: " + NumToStr( dt[i], formatDateTime ) + " Eq: " + Eq[i] ); } i: 2182 Date: 9/8/2009 Eq: {EMPTY} i: 2183 Date: 9/9/2009 Eq: 196780 i: 2184 Date: 9/10/2009 Eq: 200143 i: 2185 Date: 9/11/2009 Eq: 199723 i: 2186 Date: 9/14/2009 Eq: 200235 i: 2187 Date: 9/15/2009 Eq: 203289 i: 2188 Date: 9/16/2009 Eq: 203369 i: 2189 Date: 9/17/2009 Eq: 208362 i: 2190 Date: 9/18/2009 Eq: 209573 i: 2191 Date: 9/21/2009 Eq: 211509 i: 2192 Date: 9/22/2009 Eq: 213253 i: 2193 Date: 9/23/2009 Eq: 216647 i: 2194 Date: 9/24/2009 Eq: 219080 i: 2195 Date: 9/25/2009 Eq: 230729 i: 2196 Date: 9/28/2009 Eq: 231932 i: 2197 Date: 9/29/2009 Eq: 234587
