OPEN-SOURCE SCRIPT

Captain Backtest Model [TFO]

Updated
Created by imjesstwoone and mickey1984, this trade model attempts to capture the expansion from the 10:00-14:00 EST 4h candle using just 3 simple steps. All of the information presented in this description has been outlined by its creators, all I did was translate it to Pine Script. All core settings of the trade model may be edited so that users can test several variations, however this description will cover its default, intended behavior using NQ 5m as an example.

Step 1 is to identify our Price Range. In this case, we are concerned with the highest high and the lowest low created from 6:00-10:00 EST.

snapshot

Step 2 is to wait for either the high or low of said range to be taken out. Whichever side gets taken first determines the long/short bias for the remainder of the Trade Window (i.e. if price takes the range high, bias is long, and vice versa). Bias must be determined by 11:15 EST, otherwise no trades will be taken. This filter is intended to weed out "choppy" trading days.

snapshot

Step 3 is to wait for a retracement and enter with a close through the previous candle's high (if long biased) or low (if short biased). There are a couple toggleable criteria that we use to define a retracement; one is checking for opposite close candles that indicate a pullback; another is checking if price took the previous candle's low (if long biased) or high (if short biased).

snapshot

This trade model was initially tested for index futures, particularly ES and NQ, using a 5m chart, however this indicator allows us to backtest any symbol on any timeframe. Creators imjesstwoone and mickey1984 specified a 5 point stop loss on ES and a 25 point stop loss on NQ with their testing.

I've personally found some success in backtesting NQ 5m using a 25 point stop loss and 75 point profit target (3:1 R). Enabling the Use Fixed R:R parameter will ensure that these stops and targets are utilized, otherwise it will enter and hold the position until the close of the Trade Window.
Release Notes
- Added an option to Use Stop Orders for entries. For this particular trade model, when all criteria are met and price closes through the previous high/low (if bias is long/short, respectively), an entry order will be triggered once price trades to the confirmation candle's high/low, instead of entering immediately at the following candle's open. An example of this new behavior can be seen in the following chart:

snapshot

*Note that the dataset of trades in this publication is rather low because there is not a lot of chart data relative to this strategy's trade frequency (one trade per day, at most). Being that the creators of this model did the bulk of their testing on a 5m chart, and also use some data from Electronic Trading Hours for the Price Range that determines bias, the dataset of trades is expected to be low under these conditions unless Deep Backtesting is utilized. Real Trading Hours would likely pull more data and thus more trades, however it would be insufficient to determine the default Price Range from 6:00-10:00 EST.

*Also note that the starting account value and trade size is not intended to reflect the average trader's account size and risk management. This strategy simply takes positions using one quantity of whatever the chart symbol may be, regardless of the account size.
backtestbacktestingChart patternsfuturesictmechanicalstrategy

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer