FIR design using firpm (Parks-Mclellan)
First of all make sure that your $\delta_p$ value is linear (and not in dB). The function firpm needs a linear value. Don't worry about the passband error ripple having both signs; the value of $\delta_p$ used to compute the weighting function is just the maximum error magnitude, which is $0.2$ in your case. So you correctly defined the stopband weight by $0.2/0.05=4$.

The question is if you need to write an algorithm that automatically finds the necessary filter order, or if you can just try to find the order manually. If you need an automatic procedure you could use the second output argument of [h,err]=firpm(...), which is the maximum approximation error. You could design filters with increasing orders in a loop until the error returned as a second argument from firpm is smaller than the desired value for $\delta_p$ (because the approximation error equals weight times deviation, and since you chose the passband weight to be $1$, the error equals $\delta_p$).

Finally, note that the stopband edge equals the passband edge plus the transition bandwidth. So if the transition bandwidth is really $0.3$, as in your example, then the stopband edge would be the cut-off frequency (passband edge) plus $0.3$ (which equals $0.4$ in your example). These specifications are extremely mild and can be satisfied by a filter of very low order.