How To Automate TradingView Alerts to ByBit USDT Perpetual

Bybit

Tradingview to Anywhere tool has made it possible to automate TradinView alerts and TradingView strategy to ByBit USDT Perpetual . The bot uses human-like commands that can be combined with TradingView’s dynamic alert messages. Once you have set up your TradingView to ByBit Webhook, proceed to set up alerts on TradingView as explained below:

Automating TradingView Strategy to ByBit USDT Perpertual
For a strategy that generates long, and short commands only, use {{strategy.order.action}} which will return the string “buy” or “sell” for the executed order.
For a strategy with long, short, and exit commands, use {{strategy.market_position}} - which returns the current position of the strategy in string form: “long”, “flat”, or “short”.
Specify the exchange, quantity, and account using the TradingView to Anywhere commands.

For Example:

  1. A strategy with a long and short command only:
    Close BTCUSDT
    {{strategy.order.action}} BTCUSDT q=0.002 L=5 tp=10% sl=5% - this will only work if the position mode settings is on one way position mode.
    or,
    Close BTCUSDT
    {{strategy.order.action}} BTCUSDT q=0.002 L=5 tp=10% sl=5% hedge - this will only work if the position mode settings is in hedge mode.

  2. A strategy with a long, short, and exit Command:
    {{strategy.market_position}} BTCUSDT q=0.002 tp=10% sl=5% - this will only work if the position mode settings is on one way position mode.
    or,
    {{strategy.market_position}} BTCUSDT q=0.002 tp=10% sl=5% hedge - this will only work if the position mode settings is in hedge mode.

You can add more parameters such as p= to convert positions into pending orders.

Automating TradingView Indicator to ByBit USDT Perpetual
To automate an indicator, select the indicator as to the condition, choose long or short condition, select once per bar/close to avoid repainting issues, and input the applicable buy/sell command in the message field.

For example:

  1. Buy Alert
    Close BTCUSDT
    Buy BTCUSDT Q=0.002 L=10 tp=10% sl=5%
  2. Sell Alert
    Close BTCUSDT
    Sell BTCUSDT Q=0.002 L=20 tp=10% sl=5%

In the above example, the alert will close any BTCUSDT open positions before going long/short 0.002 BTC, place the take profit, and stop loss accordingly on your ByBit USDT Perpetual account.

Please note that Q as a percentage of your balance is now supported.

Automate your TradingView script to Binance today :slight_smile:

Hi,

How do we go about adding leverage to a ByBit USDT trade? Would it be the same as binance futures?

Hello,
To set leverage on ByBit, go to the instrument you are trading on ByBit, set the leverage to use, and the Bot will apply it automatically when opening trades.

Regards

I have a trailing SL on my strategy on TV, how this will work ?

sorry, I dont understand, TV will sent when to TP or SL… I dont understand how to set up this message actually

Hello, we do not support trailing in ByBit at the moment.

If I want to open a position using 50% of my account, would this be the correct example?:
buy BTCUSDT q=50% tp=2% sl=1% hedge

Hello @Nu-Ark, yes this is a correct example.

1 Like

If I am in hedge mode, and have two open positions in different direction, is there a command that close only the long or short position before entering the next trade?
Potential example:
Close Long BTCUSDT / Close Short BTCUSDT?

Hello @TNK4crypto Yes there is a command to do that. Let’s say you want to close a long position of BTCUSDT, the command would be Close BTCUSDT T=Long