Okay, I see mistake. In case anyone else needs this:
TrendUp = C1 > C2 AND C2 > C3; TrendDown = C1 < C2 AND C2 < C3; instead of C1 > C2 > C3 etc.... --- In [email protected], "ozzyapeman" <[EMAIL PROTECTED]> wrote: > > 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 [email protected], "Ara Kaloustian" <ara1@> 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: [email protected] > > 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! > > >
