This paper estimate the impact of stock price index on foreign exchange rate, for five members of D8 countried including Iran, Indonesia, Malaysia, Pakistan and Turkey. On the basis of balanced portfolios, demand for foreign investment means investing in the stock market stabilization and subsequent increase in demand for currency, these two variables should have a negative relationship. However, the evidence obtained from the traditional method of ordinary least squares estimation is not optimal, Quantile regression model to show the impact on the stock market, the foreign exchange market under different market conditions were considered. the results show an interesting relationship between the two markets, which indicates a negative relationship between stock markets and foreign exchange, and the exchange rate is too high or low, this relationship is more pronounced.