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

Re: [amibroker] rounding the buyprice



PureBytes Links

Trading Reference Links

Yuki,
	I have uploaded 

http://groups.yahoo.com/group/amibroker/files/PLUGIN%20DLL/TSEtick.zip

also	see interspersed comments below.

	Nigel


On Mon, 3 Mar 2003 09:36 pm, Yuki Taga wrote:
> Hi Nigel,
>
> Well, we can certainly try it and see what happens.  Here are the
> Tokyo rules:
> . . .

Thanks, Yuki, I found them at http://www.tse.or.jp/english/faq/p_e.html

> If price is (I have never traded anything higher, and probably never
> will.)  ^_-

BTW, does ANYTHING trade at over 30million/share!!!  (And I thought NYSE:BRKa 
was expensive at about $64,000!)

>
> There are no fractions ever.  The yen is indivisible.  

The DLL *should* only ever give you integer values (if it doesn't, it's a bug, 
probably related to floating point rounding, let me know).


> One problem I
> can foresee is that for buyprice I would always round up, and for
> sellprice I would always round down.

The optional 3rd argument to most of the functions adjust the way prices are 
rounded.  

If round = 0 (the default), it rounds to nearest tick 
	2002->2000, 2003->2005, 51024->51000, 51025->51050

If round = -1, it truncates (if needed) down to the next lower tick
	2002->2000, 2004->2000, 51049->51000

If round = 1, it adjusts (if needed) to the next higher tick
	2000->2000, 2001->2005,  51001->51050

To get the BuyPrice and SellPrice to adjust in the right direction, I would 
suggest

BuyPrice=nrTSEtick(BuyPrice, 0, 1); // adjust to tick, equal or above
SellPrice=nrTSEtick(SellPrice, 0, -1); // adjust to tick, equal or below

If you want to force some aditional slippage, (say 1 tick)

BuyPrice=nrTSEtick(BuyPrice, 1, 1); // add one tick and adjust upward
SellPrice=nrTSEtick(SellPrice, -1, -1); // sub one tick and adjust down

>
> Yuki
>

Let me know how it goes
	Nigel



-- 
	Nigel Rowe
	<rho@xxxxxxxxxxx>


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/