Automating TradingView Strategy Alerts to MT4

Automating TradingView alerts to MT4 is now very simple and possible thanks to the Tradingview to Anywhere tool. The bot uses human-like commands that can be combined with TradingView’s dynamic alert messages.

After creating your TradingView to Mt4 setup, and sending a test to make sure it is running successfully, it is now time to connect to TradingView and start automating the alerts generated by your strategy. Paste the Webhook received on the Webhook URL field of the alerts and format the commands on the message box as follows:

Automating TradingView Strategy to MT4
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”. Specify the pair symbol, quantity, and at this point, you can add other TradingView to Anywhere commands as provided for in the list of commands such as take profits, stop loss, trailings, and so on. For Example, *{{strategy.order.action}} {{ticker}} Q=0.02 tp=200 sl=100 will buy/sell 0.02 lots of EURUSD and place your take profit and stop loss 200 and 100 points away respectively.
For brokers with symbol extensions, remember to include them in the syntax after the symbol or in the EA settings. Example {{ticker}}pro.

Automating TradingView Indicator to MT4
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, if you choose a long condition above, the command will be Buy EURUSD Q=0.03 tp=1.22460 sl=1.04450=usdm to long 0.03 lots of EURUSD with take profit placed at the 1.22460 price level and stop loss at 1.04450 price level. A short condition will follow the same process but this time it would be Sell.

That’s all, it is that simple! :slight_smile:

The entry and exit of the strategy is to use ‘Buy’ and ‘Sell’, ex: after ‘Buy’ enters the market, it is ‘Sell’ when it exits the market. At this time, the strategy is a 0 position, and it will become a ‘buy’ order to close the position on ‘MT4’ After placing the ‘sell’ list. How to solve it?

I did not understand your question, but if your strategy has an exit command, then use {{strategy.market_position}}. Example:|
*{{strategy.market_position}} {{ticker}} Q=0.02 tp=200 sl=100

Hello, my strategy comes with exit, and the exit order is ‘Sell’ in Tradingview, and the signal becomes ‘Sell’ entry after MT4

If your strategy has an exit, then follow the previous reply, you will be able to get a buy, sell and exit command from your strategy.

I have the same problem. After ‘entry’ buy I have soon ‘exit’ sell and two trades are open: buy and sell.
Any idea how to solve it?

Hello, please note that using * {{strategy.market_position}} - returns the current position of the strategy in string form: “long”, “flat”, or “short”. And it is suitable if your strategy does give a flat/close command of the previous position before opening the next position.

{{strategy.order.action}} - returns the string “buy” or “sell” for the executed order. It is suitable for strategies that give only buy and sell and does not close the previous position before opening a new one.

Please select the correct one for your strategy and the issue is solved.