Sql help, how to apply conditions to lead() over partition

For my query, I want to get the lead t_stamp when the table.code column in that row is less than 1500.

select t_stamp, lead(t_stamp) over (order by t_stamp)  as lead
from table

This gets me all t_stamps and leads except the last lead. I was taught how to use coalesce to do that.

I tried the following. The t_stamp gets filtered, but the lead ends up catching on codes higher than 1500.

select t_stamp, lead(t_stamp) over (order by t_stamp)  as lead
from table
where code<1500

I tried a subquery, but that didn’t work either. should it have worked?
This works, but I think it will slow my query down.

select t_stamp, lead(t_stamp) over (order by t_stamp)  as lead
from (
           select t_stamp from myTable
           where code < 1500
)subq
where code<1500