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

Re: [amibroker] Determining Range of Dates displayed in Current Chart



PureBytes Links

Trading Reference Links

Hi,

Below are two functions which will return the first and last visible
dates followed by an example using title.

function LastVisibleDate()
{
         Version(4.70);
        DateArray = DateNum();
        Lvbindex = Status( "lastvisiblebarindex" );
        Lbindex = BarCount - 1;

        if ( Lvbindex > Lbindex  )
                Lvb = DateArray[ Lbindex ];
        else
                Lvb = DateArray[ Status( "lastvisiblebar" ) ] - 1;

        DayNm = round( frac( Lvb / 100 ) * 100 );
        MthNm = round( frac( Lvb / 10000 ) * 100 );
        YrNm = int( Lvb / 10000 ) + 1900;
        
        return NumToStr( DayNm, 1.0 ) + "/" + NumToStr( MthNm, 1.0 ) + "/" + NumToStr( YrNm, 1.0, False );
}

function FirstVisibleDate()
{
         Version(4.70);
        DateArray = DateNum();
        Fvb = DateArray[ Status( "firstvisiblebar" ) ];

        DayNm = round( frac( Fvb / 100 ) * 100 );
        MthNm = round( frac( Fvb / 10000 ) * 100 );
        YrNm = int( Fvb / 10000 ) + 1900;
        
        return NumToStr( DayNm, 1.0 ) + "/" + NumToStr( MthNm, 1.0 ) + "/" + NumToStr( YrNm, 1.0, False );

}

/* Example of how to use these functions */
Title = " First visible bar: " + FirstVisibleDate() + " Last Visible Bar: " + LastVisibleDate();


Regards,
William Peters
www.amitools.com




Sunday, September 25, 2005, 12:58:52 PM, you wrote:
d>    Is there an AFL function that that will return the begin/end dates
d>  displayed in the current chart, without having to manually select the
d>  range on the chart?

d>  I can find a function that returns begin/end dates for auto-analysis,
d>  but not for charts.

d>  Am using AmiBroker 4.07.5.


d>  Thanks,
d>  David





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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/

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