This is an error that occurs when you automate a Tradingview script to your Binance account when the position mode settings on your Binance account is set to Hedge-Mode.
There are two ways to solve this error:
- Go to your Binance account on the asset you are trading, and click on the button on the top-right corner of your trading panel just below the settings to open preferences. Select Preferences from the pop-out and choose Position mode and select One-Way Mode.
or - Add the hedge parameter at the end of your commands as shown below:
Automating TradingView Strategy to Binance in Hedge Mode
Use either {{strategy.order.action}} - which returns the string “buy” or “sell” for the executed order or {{strategy.market_position}} - which returns the current position of the strategy in string form: “long”, “flat”, or “short” (recommended for a strategy with a close command). Specify the exchange, quantity, and account using the TradingView to Anywhere commands.
For Example;
{{strategy.order.action}} BTCUSDT Q=0.02 a=UsdM hedge will buy/sell 0.02 BTC on Binance UsdM futures in hedge mode.
{{strategy.order.action}} BTC/USD Q=1 a=COINM hedge will buy/sell 1 contract size of BTC on Binance COINM futures in hedge mode
Automating TradingView Indicator to Binance
To automate an indicator, select the indicator as the condition, choose long or short condition, select once per bar to avoid repainting issues, and input the applicable buy/sell command in the message field.
For example:
For a long condition above, the command will be Buy BTCUSDT q=0.03 a=usdm hedge to long 0.03BTC on the Binance USDM futures under hedge mode.
Buy BTCUSDT q=1 a=COINM hedge to go long 1 contract of BTC on the Binance COINM futures under hedge mode
A short condition will follow the same process but this time it would be Sell.
That’s all, it is that simple!