It is well known, that for the efficient usage of solar energy the choosing the optimal location and direction of solar panels is one of most important issues. Finding the correct solution for this problem is especially significant in mountain regions that have a complex topography. A new method for the determination of the optimal daily panel direction is presented. The method is based on a simple mathematical model of solar radiation, which determines the amount of solar energy for any instant of time and any point taking into account shadowing of the Sun caused by surrounding relief. The optimal direction of the solar panel is determined analytically, as a solution of the derived system of equations. An algorithm for the determination of daily, monthly, seasonal and annual optimal directions is realised. The results of calculations and measurements for the chosen site are presented and the adequacy of the method is tested. The method can be especially useful for the smart determination of optimal direction and installation of panels in mountain regions which have high touristic potential and require clean energy usage.