# How can I choose the price for a limit order?

Hello, I want to program a trade coin on Kucoin. I can make a market order but it would be expensive so let’s make a limit order!
The API can give me 2 prices “lastDealPrice” and “buy” price. How can I choose a price which almost guarantee the trade and still less expensive than a market order. The course mentions the moving average price but I’m not sure that it’s suitable for my need because I don’t have a strategy (I want to implement a TWAP order)
Thanks

1 Like

Hi @Yogalholic, hope you are good.

Now I think it must be a function or variable that can calculate a % based on the last buy price and calculate the stop loss.

For example, if BTC price is 18000 \$, your stop loss variable should calculate: 10% below price, which is [18000 - 1800]. Basically the idea is to create an order has stop loss a little bit below the actual price or lastDealPrice.

Carlos Z.

1 Like

Thanks for your answer but I am not doing a stop order but a limit order. For example if I want to buy BTC and the last deal price is 18000\$, I can make a market order and buy it for 18000\$ but with a limit order it would be less expensive so I’m asking how can I chose the price in order to spare money and still be realistic. I am coding a TWAP order bot so there will be many small orders and I think if would be better with limit orders (but more complicated to code than market orders hence my question!)
I’ve made a lot of research about TWAP but couldn’t find that much informations

1 Like

Sadly I have not tried TWAP to code a trading strategy, neither the course teach you about TWAP code, it focus on PineScript which is used for tradingview strategies. Maybe that trading programming language is not focused on limit orders?

Carlos Z.

TWAP is not really a strategy. If you want to buy a huge amount of a low volume coin you can’t make a one big order you have to break it up into several small orders to make it smoothly (without affecting the price of the market)