Since computation of grids enable the sharing, selection, query and aggregation of geographically distributed resources for solving large-scale problems, developing mechanisms for grid resource scheduling is a complex undertaking problem. We had investigated several famous schedule methods proposed by Nimrod-G, a famous computational economy framework for regulating the supply and demand for resources. In this paper, we propose a novel scheduling algorithm, called deadline and cost constrained optimization algorithm, which extends Buyyapsilas cost optimization and time optimization algorithm, keeping the cost and time optimization at same time. Our optimization algorithm, which is based on proportional share (PS), allows users to bid higher in order to gain more resource shares. Therefore, this algorithm adjusts a user bid periodically on these systems in order to finish the application on time. Empirical results show that the algorithm had better performance than with conventional algorithms.