If you are only concerned with the number of bars, you could use BarIndex, 
e.g....

startDay = LastValue( ValueWhen( Cond1 , BarIndex() ) );

Steve

----- Original Message ----- 
From: "Mr. Valley" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 03, 2006 8:38 PM
Subject: [amibroker] DaysBetweenDates()


>
> I'm having trouble with calculating the number of days between the dates 
> of
> two conditions, either daily or intraday intervals.  I looked at the
> DeDateTime.dll
> These were planned functions, but I don't see them implemented.
> GetDaysBetween() and GetTradeDaysBetween()
>
> Also tried...
>
> /* Days Between Dates v3 */
>
> price = Close;
> sig = MA(High,20);
> Cond1 = Cross(price,sig);
> Cond2 = Cross(sig,price);
>
> startDay = LastValue( ValueWhen( Cond1 , 1 ) );
> endDay = LastValue( ValueWhen( Cond2 , 1 ) );
> Daysbetween = abs(endDay - startDay  );
> Plot(Close,"Close",1,1);
> Plot(sig,"sig",2,1);
> Plot(Daysbetween ,"Daysbetween ",10,1 | styleOwnScale);
>
> //////////////
> Also Tried this and wasn't able to resolve it to what I am trying to do.
>
> /* Days Between dates v2 */
> SetBarsRequired(1000,0);
> function GetDaysInRange()
> { fb = Status("firstbarinrange");
> eb = Status("lastbarinrange");
> startday = LastValue( ValueWhen( fb, DayOfYear() ) );
> startyear = LastValue( ValueWhen( fb, Year() ) );
> endDay = LastValue( ValueWhen( eb, DayOfYear() ) );
> endYear = LastValue( ValueWhen( eb, Year() ) );
> Days = 365 * ( endYear - startyear ) + endDay - StartDay;
> return Days;
> }""+GetDaysInRange();
>
> //Title = "" + GetDaysInRange();
> Plot(Close,"Close",1,1);
> Plot(GetDaysInRange(),"GetDaysInRange()",1,1);
>
> Any Suggestions?
> Thanks in advance.
>
> Mr Valley
>
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
> 




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 other support material please check also:
http://www.amibroker.com/support.html

 
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:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to