Quick Examples

Software part of algotrading is simpler than you think. TradingView+TradingConnector is a great combo to do this actually. Have a look at the examples published on TradingView website. We took example scripts straight from TradingView’s PineScript default list (so-called “built-ins”), added 2 lines of code to each - lines of code responsible for triggering alerts - and that’s all.

When configuring alert, make sure to select "alert() function calls only" in CreateAlert popup. One alert per ticker is required.

This routing works for Forex, indices, stocks, crypto - anything your broker offers via their MetaTrader4 or 5.

Disclaimer: These concepts are presented for educational purposes only. Profitable results of trading these strategies are not guaranteed even if the backtest suggests so. By no means this post can be considered a trading advice. You trade at your own risk.

If you are thinking to execute any of those presented strategies, make sure to find the instrument, settings and timeframe which you like most. You can do this by your own research only.

 
Screenshot 2021-09-10 at 11.22.46.png

RSI STRATEGY

Entries are made each time when RSI returns from the oversold/overbought areas.

https://www.tradingview.com/script/kQY2gaLx-RSI-Strategy-with-alerts-via-TradingConnector-to-Forex/


Screenshot 2021-09-10 at 11.17.31.png

CONSECUTIVE UP/DOWN STRATEGY

Reversal entries are made each time 3 candles in one direction happen in a row. The number of consecutive candles is configurable.

https://www.tradingview.com/script/HjySseyp-Consecutive-Up-Down-Strat-alerts-via-TradingConnector-to-Forex/


Screenshot 2021-09-10 at 11.20.22.png

PIVOT REVERSAL STRATEGY


BOLLINGER BANDS STRATEGY WITH PENDING ORDERS

Bollinger Bands Strategy with pending orders (limit orders / stop orders) - example how to code limit/stop orders in PineScript and forward them to MetaTrader for execution.

https://www.tradingview.com/script/a5CmxEJq-BollingerBands-Strat-pending-order-alerts-via-TradingConnector/


Screenshot 2021-10-01 at 12.37.11.png

ALERTS WITH DYNAMIC VARIABLES

Stochastic-based strategy showing how to use dynamic variables and partial Take-Profit (if your broker allows it).

https://www.tradingview.com/script/9MJO3AgE-TradingView-Alerts-to-MT4-MT5-dynamic-variables-NON-REPAINTING/


HOW TO FORCE STRATEGIES FIRE EXIT ALERTS NOT REVERSALS

In default and most often used TradingView setup alerts set on strategies using {{strategy.order.action}} fire “buy” on exiting sell positions and “sell” on exiting buy positions. This causes improper entries to trading bots. This post explains how to fix things.

https://www.tradingview.com/script/gOhpP3Ri-How-to-force-strategies-fire-exit-alerts-not-reversals/


ADVANCED: CONTROL SPECIFIC TRADE WITH TRADEID=

This example PineScript code shows how to control (close, closepart or modify stoploss/takeprofit) only in particular position, not all of them.

https://www.tradingview.com/script/BTSkg8IP-TradingView-Alerts-to-MT4-MT5-Forex-indices-commodities/