A trading strategy simply consists in a procedure which defines conditions for buying or selling a security on a financial market. These decisions rely on the values of some indicators that, in turn, affect the tuning of the strategy parameters. The choice of these parameters significantly affects the performance of the trading strategy. In this work, an optimization procedure is proposed to find the best parameter values of a chosen trading strategy by using the security price values over a given time period; these parameter values are then applied to trade on the next incoming security price sequence. The idea is that the market is sufficiently stable so that a trading strategy that is optimally tuned in a given period still performs well in the successive period. The proposed optimization approach tries to determine the parameter values which maximize the profit in a trading session, therefore the objective function is not defined in closed form but through a procedure that computes the profit obtained in a sequence of transactions. For this reason the proposed optimization procedures are based on a black-box optimization approach. Namely they do not require the assumption that the objective function is continuously differentiable and do not use any first order information. Numerical results obtained in a real case seem to be encouraging.