Updated Version of the script:https://usethinkscript.com/threads/...ng-days-in-thinkorswim.9767/page-2#post-89110
After posting a request for help to code a strategy taken from the book " A Complete Guide to the Futures Market Technical Analysis and Trading Systems, Fundamental Analysis, Options, Spreads, and Trading Principles" by Jack D. Schwager and Mark Etzkorn, Mr. @Svanoy did a terrific job with the script: https://usethinkscript.com/threads/wide-ranging-days.9294/#post-88073
This strategy is based on "Wide Ranging Days". I'll leave a transcprit of the part of the book which includes the basic definitions and describes the strategy:
Wide-ranging day. A day on which the volatility ratio (VR) is greater than k (e.g., k = 2). The
VR is equal to today’s true range divided by the average true range of the past N-day period
(e.g., N = 10).
Price trigger range (PTR). The range defined by the highest true high and lowest true low in
the interval between N1 days before the most recent wide-ranging day to N2 days after. Note
that the PTR cannot be defined until N2 days after a wide-ranging day. (If N2 = 0, the PTR
would be defined as of the close of the wide-ranging day itself.) The PTR will be redefined each
time there is a new wide-ranging day (i.e., N2 days after such an event).
Buy case. On a close above the high of the PTR, reverse from short to long.
Sell case. On a close below the low of the PTR, reverse from long to short.
To generate trading signals, perform the following steps each day:
1. If short and today’s close is above the high of the PTR, liquidate short and go long.
2. If long and today’s close is below the low of the PTR, liquidate long and go short.
3. Check whether exactly N2 days have elapsed since the most recent wide-ranging day. If this
condition is met, redefine the PTR.
Last edited by a moderator: