TradingView Strategies
Discord Get started

TradingView Strategies

Stocks Strategy

Build a TradingView strategy that buys shares on a buy alert and sells them on a sell alert: setup, sizing, exits, how each broker sells, and testing.

A stocks strategy trades shares of the ticker on your chart. It is the simplest TradingView strategy: a buy alert buys, a sell alert sells.

A stocks strategy trades long: buy opens, sell closes BUY ALERT Buys shares HOLDING Shares of AAPL SELL ALERT Sells them Sell alert, nothing held Nothing is sold, and nothing new is opened. No short selling from alerts IBKR, Tradier and Robinhood never open a short.

Brokers: Interactive Brokers, Tradier, Robinhood and Charles Schwab.

Build it

  1. Create your alert in TradingView and prepare it in the app. How TradingView Trading Works shows how.

  2. On Strategies, click New strategy.

  3. In Signal source, set Source to TradingView.

  4. In Basics, set Name to your alert’s name, without any indicator long or indicator short suffix.

  5. Set Instrument to Stocks and choose your broker on the Brokers tab.

  6. Set Direction to Long or Both.

  7. Set Ticker to the symbol on your chart, like AAPL, or ALL to trade whatever the alert sends.

  8. Set the size, a stop loss and a take profit (below).

A TradingView stocks strategy in the editorA TradingView stocks strategy in the editor A stocks strategy with TradingView as its source.

Order settings

SettingChooseWhy
EntryMarket to fill now, Limit to wait for your priceLimit is only offered on brokers that take it.
ExitMarketA limit exit that does not fill leaves you in the trade.
Time in forceDayAn unfilled order is cancelled at the close, not left for tomorrow.
Allow extended hoursOn, if you trade pre-market or after-hoursIBKR only. Spreads are wider outside regular hours.

How much to buy

Under Sizing, set How to pick the trade size to Fixed size, then set Default quantity in one of three units.

UnitExampleWhat is bought
Shares1010 shares
Dollars$500As many shares as $500 buys
Percent5%5% of the account, on IBKR and Tradier

A sell alert sizes from what is held, not from this setting.

Getting out

A sell alert is one way out. Stop loss and Take profit under Risk management are the other: they close the position if price gets there first, even with no alert.

Heads up

How much a sell alert sells depends on the broker. IBKR sells only the shares this strategy bought. Tradier and Schwab sell the whole position at the broker, including shares you bought yourself. On Robinhood, a share-count size sells up to that many shares, and a dollar size sells everything held. Keep a TradingView stocks strategy in an account you do not trade by hand.

Short selling

Alerts do not open short positions on IBKR, Tradier or Robinhood. A sell alert with no shares held does nothing. Use Long or Both. Short is not a way to short a stock from TradingView on these brokers.

Test it

  1. Set a small size, like 1 share.

  2. Fire the buy alert from TradingView. Activity shows the alert, the order and the fill.

  3. Fire the sell alert. The shares are sold and the position closes in Positions.