Hello,
You can use Lookup function for that.
startdt = StrToDateTime( ParamDate("start", "2016-04-28", 1 ) );
enddt = StrToDateTime( ParamDate("end", "2016-12-01", 1 ) );
startval = Lookup( Close, startdt, -1 );
endval = Lookup( Close, enddt, -1 );
dollar_return = endval - startval;
percent_return = 100 * ( endval - startval ) / startval;
Best regards,
Tomasz Janeczko
amibroker.com
I wish to calculate the returns in between a set of FROM-TO dates
An initial code looks like this:
Filter=1;
dn = DateNum();
FromDate = ParamDate("Start Date","13-03-14");
LastDate = ParamDate("Last Date",Date());
How do I get the Close for FromDate and LastDate?
Posted by: Tomasz Janeczko <groups@amibroker.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon