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.
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?
Hello,
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, 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.
Hello, I have finished setting up the webhook with MT4. But every time TDV strategy has a signal, checking MT4 always shows an error “Invalid Params Symbol Not Found”. I am currently trading the XAUUSD pair on Exness. I have set up an Alert with the following command:
For traili g to be triggered, your trade must be in profit by the specified trailing trigger. You can edit your values to 0.2 and not .2 and try again.