Select Page

Box Theory Trading Strategy for TradingView

APIBridge, TradingView

Strategy Premise

This is a trend following strategy which plots the boxes based on the length provided. Any breach in the box creates a signal to enter a position. Please read https://tradingsim.com/blog/darvas-box/ for more details on the Darvas Box Theory.

Box Theory Trading Strategy for TradingView

Strategy Logic

Long Entry: When candle closes above the green line, send LE

Long Exit: Either when SL or Target is hit. If SL/TGT is not hit, and when candle closes below the red line, send LX and SE

Short Entry When candle closes below the red line, send SE

Short Exit: Either when SL or Target is hit. If SL/TGT is not hit, when candle closes above the green line, send SX and LE

Box Theory Parameters for TradingView Charts

Box Length: Length of Box based on the number of previous candles

Quantity: This is used to specify the trade quantity 

Custom Stop Loss in Points: Movement in chart price against the momentum which will trigger exit

Custom Target in Points: Movement in chart price against the momentum which will trigger exit

TradingView Settings

To apply Box Theory Trading Strategy for TradingView follow the steps given below.

Step 1: Download the PineScript Algo

Step 2: Open desired chart in TradingView with normal candlestick. Select desired timeframe of the chart.

Go to the Pine Editor section, remove the default code, paste the downloaded code, save the file and add to chart.

TradingView Settings

Step 3: Once Strategy is applied to the chart, click on settings to optimize parameters for your own trading.

Optimize parameters for your own trading

Step 4: Setting Up Alert

Before setting up an alert make sure that You have selected the desired script, timeframe, strategy settings, API bridge is configured and running. Click in settings add alert and paste {{strategy.order.comment}} in the message box.

Important: Do not change any settings during live trading.

NOTE: The pine script works both with webhook alerts (TV Pro plan) and normal popup alerts (TV free plan).