This is a two part question:

I have 3 variables that I want to use to make buy limit orders(Call them moving averages). My approach to this has been to try and find the closest support point to the current market price and create a limit buy order at that variable support price.

Question 1:

I have been trying to create code that will tell me what the closest support point is under the current price and put a limit buy order at that price. If that order gets filled then find the new closest variable for a buy price, etc. Is this the best way to accomplish this? Is there some sort of function that will tell me what I need to know?

Question 2:

Lets say one of the variables is 1142.58. And I do a limit at that price in the ES futures which increments in .25. Will the order be 1142.50 or 1142.75? Also how can you make your order round up to the nearest tick.