• First, sort out your database design.  If a column is going to hold money data, give it a decimal data type, not nvarchar.  If the data in your column is always seven characters wide, define it as (n)char(7).  And if you've got duplicates in your data (or even if you haven't), add a primary key or unique constraint on tarih and index.

    Now the query.  You're doing a cross join between the results of the two subqueries.  If each subquery returns a thousand rows, the cross join will return a million.  Read about and understand the new-style join syntax (INNER JOIN, LEFT JOIN, RIGHT JOIN etc) and use it.  I imagine you want to join on coin = coin and datediff = 3 minutes, don't you?  Read about windowing functions as well: you may be able to use LAG or LEAD to avoid joins altogether.

    That's the best advice I can give in the absence of table DDL and sample data.

    John