How can you find the best altitude for range or speed?
Generally, climbing as high as you can would be close to the optimum strategy. In the end, the altitude is given by the optimum lift coefficient in cruise, which can be approximated as $$c_L = \sqrt{\frac{1-n_v}{n_v+3}\cdot \pi \cdot AR \cdot \epsilon \cdot c_{D0}}$$
Now it will be important to get the thrust over speed dependency right, which is expressed with $n_v$. A turboprop should have $n_v \approx -0.7$. The rest is determined by the aerodynamics of your plane.

Nomenclature:
    $c_L \:\:\:$ lift coefficient
    $n_v \:\:\:$  thrust exponent, as in $T \sim v^{n_v} $
    $\pi \:\:\:\:\:$  3.14159$\dots$
    $AR \:\:$  aspect ratio of the wing
    $\epsilon \:\:\:\:\:$  the wing's Oswald factor
    $c_{D0} \:$  zero-lift drag coefficient

If you have the optimum $c_L$, you need to find the altitude where level flight at cruise power will require this lift coefficient. Depending on the range of your small aircraft, you might spend most of the flight in climb and descent.

Maximum speed altitude: Draw the envelope at max power, and look for the rightmost point which can be trimmed. The equation above uses the quadratic polar approximation which works well at high lift coefficients, but for maximum speed the details of friction and parasitic drag are important, and they cannot be captured with a simple formula.