hi,
I thought I did this before but can't seem to
figure it out anymore, drives me nuts. I am analysing trade output from
Interactive Brokers (my trades) and want to compare entry / exit prices with the
open price. I need to retrieve the open price at a certain
date.
Below some test code. It only seems to get the
price when I have the mouse on clicked on the bar for that specific date. How
can I independently from mouse clicks etc. get 1 number from an array and put it
in a number (instead of an array)?
thanks, Ed
function getOpenPrice(oprice) {
var = 0; cnt = 0; for (i = 0; i < BarCount - 1; i++) {
cnt = cnt + 1; if (oprice[ i ] != 0) {
printf("*FOUND* " + "\n");
var[ cnt ] = oprice[ i
]; break;
}
}
return var[ cnt ];
}
//SetBarsRequired(10000,10000); oo = Foreign( "ABX", "O"); dateString = "5/9/2007"; oprice = IIf(Date() == dateString,oo,Null); op = getOpenPrice(oprice);
""; "Open: " + WriteVal(op); "date:
" + Date(); Plot(oprice,"",colorWhite,1);
__._,_.___
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
SPONSORED LINKS
__,_._,___
|