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

Re: [amibroker] Export help -- suplement [OT]



PureBytes Links

Trading Reference Links

hello Michael,

> I also noticed you had some large values in the export VOHLCx.
> Which made me think of exporting composites.
> 
> So I passed an Integer of larger than 4 digits though, Needless to say - 
> The extra digits were truncated.
> 
> Here is a revised version of your code - To include any integers greater 
> than 4 digits.
> I hope it works ok <grin>
> 
> return 
> str.substring(0,((str.indexOf(".")==-1)?(str.length-3):0)+str.indexOf(".")+4);

thanks Michael for this sequel :) yes, it was my oversight. thanks for correcting code. 
your post also forced me to rethink export.js case. please consider the following code 
that preserves four digits accuracy (eg. forex quotes). required accuracy can be set via 
*acc* variable.

function FormatFloat( number ) {
   var t, acc=4;
   var s=(Math.pow(10,-acc)*Math.round(number*Math.pow(10,acc))).toString();
   return s.substring(0,((t=s.indexOf("."))<0)?s.length:1+acc+t);
}

again, maybe someone will find it useful,
cheers,
BM


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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