Back to FAQ index page

Binance: “Margin is insufficient.”


This error means that your strategy generate Order Size which is larger than Your current Account Balance multiplied by Account Leverage.

Order Contracts * Order Price > Account Balance * Account Leverage

For example, if you strategy is trying to buy 10 units of the BTCUSDT contract with Unit Price = 30,125 USDT, but you have 100 USDT on Account and 125x Leverage allowed, your trade will not progress and you will get “Margin is insufficient.” error.
Position Size = 30,125 USDT * 10 = 301,250 USDT
Buying power = 100 USDT * 125x = 12,500 USDT
301,250 USDT > 12,500 USDT

So, you should controll the Order Size to be within you Buying Power based on your Available Balance and Leverage. Below you can find some options how to controll your Position Size in the PineScript.

Solution Options (Trading View Interface)

You can configure Order size in the TradingView Strategy Properties window. Please choose the Order Size value which will be used in each BUY/SELL trade.

IMPORTANT: Pleas do not forget to recreate your Alert after any changes in the Strategy.

Solution Options (PineScript):
Controll of the Default Open Position based on PineScript Strategy Parameters:

  strategy('My Strategy', overlay = true, initial_capital = 100, default_qty_type = strategy.percent_of_equity, default_qty_value = 100) 


initial_capital = 100 – Make it equal to you Account Balance
default_qty_type = strategy.percent_of_equity, default_qty_value = 100 – Define to use 100% of Initial Capital in each trade.
You can change to default_qty_value = 500 for 5x Leverage, 12500 for 125x Leverage and etc.

Another option, you can controll position size in the Entry command:

  position_size = 0.01  

  // use custom position size in trade
  strategy.order("Long", strategy.long, qty = position_size)
  strategy.order("Short", strategy.short, qty = position_size)