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

[amibroker] Re: Getting the date of a one-minute bar as an Alternative to changing TimeFrames!



PureBytes Links

Trading Reference Links

Thanks. Please let me know if the following is workable.

First, I put this before my BarCount loop, to create variables that get filled with the last 3 daily closes:

// Get the values of the last 3 Daily Closes
DayChange = DateNum() != Ref(DateNum(),-1);

C1        = ValueWhen(DayChange,C,1);
C2        = ValueWhen(DayChange,C,2);
C3        = ValueWhen(DayChange,C,3);

// Trend Tests
UpTrend    = C1 > C2 > C3;
DownTrend   = C1 < C2 < C3;



Then inside my BarCount loop, in my one-minute timeframe, I have something like this:


for (i = start; i < BarCount; i++)
{
.
.
.
 
if ( UpTrend [i] )          BuySignal[i];
if ( DownTrend [i] )    ShortSignal[i];



The problem is that the AFL is only generating DownTrend signals, even though the symbol data clearly has just as many UpTrends.

Is my general approach correct? Or is there a flaw in my logic?

I have half the code outside the loop because when I try to put all of the above sections inside the BarCount loop, AB crashes.


--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>
> Try this:
>
> DayChange = Datenum() != Ref(DateNum(),-1);
>
> PriorDate1 = ValueWhen(DayChange,Ref(DateNum(),-1),1);
> PriorDate2 = ValueWhen(DayChange,Ref(DateNum(),-1),2);
> etc
> ----- Original Message -----
> From: ozzyapeman
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Sunday, September 14, 2008 9:32 PM
> Subject: [amibroker] Getting the date of a one-minute bar as an Alternative to changing TimeFrames!
>
>
> Hoping someone can help with this.
>
> In a BarCount loop with a one-minute chart, how do we find the date of a given bar, and compare that value to the dates of any other bar? I simply want to find the values of the last three DAILY closes.
>
> Right now, I am using the following to find that last three DAILY closes from any given bar in my one-minute time frame, but these TimeFrame calls are slowing down my AFL horrendously:
>
> for (i = start; i < BarCount; i++)
> {
> .
> .
> .
> // Get last 3 Daily Closes for trending tests
>
> C1 = TimeFrameGetPrice( "C", inDaily, -1 );
> C2 = TimeFrameGetPrice( "C", inDaily, -2 );
> C3 = TimeFrameGetPrice( "C", inDaily, -3 );
>
>
> So instead of the above, I want to stay with my one-minute time frame and somehow find the last three daily closes by figuring out which one-minute bars correspond to the closes of the three previous days. Any ideas or can someone point me to the right resource?
>
> Thanks!
>
__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___