Hello, // TickSize = ... defines tick size
PriceRounded = floor( Close / TickSize ) * TickSize; // rounding down PriceRounded = ceil( Close / TickSize ) * TickSize; // rounding up Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: cstrader To: [email protected] Sent: Wednesday, October 31, 2007 7:25 PM Subject: [amibroker] Price-to-nearest-tick alogrithm For someone who is smarter than me, I have a question: I would like to find an algorithm that locates the nearest tick (up or down, as specified) to a given price. for instance, if the price is 106.76, and the tick is 1.00, then I'd like to find either 106 or 107, as requested Similarly, if the price is 1500.91, and the tick is .25, then I'd like to find either 1500.75 or 1501.00. I'm sure it's simple.... tia chuck
