Kevin_in_GA 4,599 posts msg #139397 - Ignore Kevin_in_GA |
11/19/2017 1:37:25 PM
I haven't shared a trading system in a while here on SF, but thought that it might be nice to let folks see some things that I have been developing. I have been posting a bunch of XIV trades lately using entry signals from a set of filters I developed several months ago, and have been trading profitably since then. Given the very high volume of shares traded on XIV each day - usually over 10 M shares, or over $1B USD - there is really no reason not to share this system with others here at SF, since even if we all traded the same signals at the same time it would not move the price of XIV even a penny.
Reminder - I do all my systems development in Stratasearch, and the following filters use Stratasearch code rather than Stockfetcher code. Some of the filters can easily be converted into SF code, but others simply can't due to limitations in SF syntax and code capabilities. What makes SF so easy for writing filters also limits what it can do versus other programs. Please do not ask to have these converted into SF code - take it upon yourself to do that if you are really interested in using them in SF.
Those who have already downloaded and are using Stratasearch can employ the following codes immediately. If you have not downloaded the fully functional public version (free!) of SS, here is the link:
Link to Stratasearch v4.5.40
I'm not sure how much longer this will be available, so take advantage soon. Here also is a great resource on how to use the program (of course, read the manual first):
Stratasearch Forum
To make things even easier, I'll provide all of the required files that can be readily imported into SS to anyone who wants them - just email me here and I will send them to you.
The system was developed against the trading period from 1/1/2013 through 6/1/2017, and is composed of 30 separate filters that, when combined, provide the nightly signals. I did this because while the individual filter results were good, no one filter provided enough trading signals to make any decent money, especially against a simple Buy and Hold for XIV. However, combining them led to a very robust and profitable system that can be traded in up to 10 "allocated units" of capital to insure that you are maximizing the activity of your trading capital. It is also analogous to "scaling in" and out of a given trade based on the prevailing signals.
First, the results:
Equity Curve (based on a portfolio of 10 Units to be allocated to trades):
And the stats:
I benchmarked this against a standard Buy & Hold of XIV, which is a real challenge for any system to compare against. What I particularly like about this system is that it gave almost identical ROI but with a MUCH smoother equity curve, even though this is an all-long set of XIV filters. Note that the monthly Sharpe Ratio for this system is 0.5949, or just over 2.0 annualized, versus 0.2662 (0.92 annualized) for the Buy & Hold approach.
Here are the specific Stratasearch filters - some of the can be converted into SF code, which I will leave for others to sharpen their skills.
FILTER 1
ENTRY:
// Projection Oscillator Divergence: 1
(diverge(pjo(8), mov(close, 3, simple), 7, 11) = 1)
EXIT:
// MACD: 2
(crossabove(macd(), mov(macd(), 17, exponential))) or
// Long Stop Loss / Short Stop Gain (Supporting Exit)
(stopdown(5))
FILTER 2
ENTRY:
// Momentum: 2
(crossbelow(mom(close, 5), mov(mom(close, 5), 9, exponential))) and
// Correlation Analysis - High to Market Periods
(mov(cor(close, sector($curexchange, close)), 20, simple) > 0.2) and
// Momentum Divergence - Market Periods: 1
(sector($curexchange, close) <> sector($curexchange, high(close, 10)) or
sector($curexchange, mom(close, 13)) = sector($curexchange, high(mom(close, 13), 10))) and
// Stochastics %K Divergence - Stock Periods: 1 (Supporting Entry and Exit)
(diverge(stochk(11, 3), mov(close, 3, simple), 5, 9) <> -1) and
// Inertia - Stock Periods: 1 (Supporting Entry and Exit)
(inr(10, 19) > 50)
EXIT:
// Momentum: 2
(crossabove(mom(close, 5), mov(mom(close, 5), 9, exponential))) or
// Correlation Analysis - High to Market Periods
(mov(cor(close, sector($curexchange, close)), 20, simple) < 0.65) or
// Momentum Divergence - Market Periods: 1
(sector($curexchange, close) = sector($curexchange, high(close, 10)) and
sector($curexchange, mom(close, 13)) <> sector($curexchange, high(mom(close, 13), 10))) or
// Stochastics %K Divergence - Stock Periods: 1 (Supporting Entry and Exit)
(diverge(stochk(11, 3), mov(close, 3, simple), 5, 9) = -1) or
// Inertia - Stock Periods: 1 (Supporting Entry and Exit)
(inr(10, 19) < 50) or
// Long Stop Loss / Short Stop Gain (Supporting Exit)
(stopdown(5))
FILTER 3
ENTRY:
// Price Oscillator: 2 (Primary)
(crossbelow(po(7, 50, exponential), 0))
EXIT:
// Stochastics %D Signal: 1 (Primary)
(crossbelow(stochd(5, 2, 9, simple), 70))
FILTER 4
ENTRY:
// Price Oscillator: 2 (Primary)
(crossbelow(po(11, 40, exponential), 0))
EXIT:
// Money Flow Index Divergence: 1 (Primary)
(diverge(mfi(17), mov(close, 3, simple), 5, 17) = -1)
FILTER 5
ENTRY:
// Price Rate-Of-Change: 2 (Primary)
(crossbelow(proc(close, 5), 7.75)) and
// Moving Average Crossover - Stock: 1 (Supporting Entry)
(mov(close, 1, simple) > mov(close, 20, simple))
EXIT:
// Chande Momentum Oscillator - OB/OS: 1 (Primary)
(crossabove(cmo(23), 32))
FILTER 6
ENTRY:
// Envelopes: 2 (Primary)
(crossbelow(close, envl(25, 10, simple))) and
// Avg Directional Movement - Stock (Supporting Entry)
(adx(6) > pdi(6) or adx(6) > mdi(6))
EXIT:
// Stochastic Momentum Divergence: 1 (Primary)
(diverge(smi(13, 8, 8), mov(close, 3, simple), 3, 11) = -1)
FILTER 7
ENTRY:
// Momentum Divergence: 1 (Primary)
(close = low(close, 25) and mom(close, 9) <> low(mom(close, 9), 25))
EXIT:
// Aroon Crossover: 1 (Primary)
(crossbelow(aroonu(19), aroond(19)))
FILTER 8
ENTRY:
// Stochastics Crossover: 2 (Primary)
(crossbelow(stochk(9, 2), stochd(9, 2, 3, simple))) and
// Stochastic Momentum Index - Stock: 1 (Supporting Entry)
(smi(15, 2, 2) < -38)
EXIT:
// Commodity Channel Divergence: 2 (Primary)
(diverge(cci(16), mov(close, 3, simple), 7, 11) = -1 and
increasing(cci(16))=1)
FILTER 9
ENTRY:
// TRIX: 2 (Primary)
(decreasing(trix(close, 5))) and
// Stochastics %K - Stock: 1 (Supporting Entry)
(stochk(13, 4) < 27)
EXIT:
// Price Oscillator Divergence: 1 (Primary)
(diverge(po(3, 60, simple), mov(close, 3, simple), 1, 7) = -1)
FILTER 10
ENTRY:
// Price Channels: 2 (Primary)
(close < pcl(17) and pcu(17)-pcl(17) > mov(pcu(17)-pcl(17), 17, simple))
EXIT:
// Stochastics %D Signal: 1 (Primary)
(crossbelow(stochd(13, 2, 3, simple), 79))
FILTER 11
ENTRY:
// Price Rate-Of-Change: 2 (Primary)
(crossbelow(proc(close, 26), 4.75)) and
// R-Squared - Stock (Supporting Entry)
(rsq(close, 20) > .20)
EXIT:
// Commodity Channel Index (Classic): 1 (Primary)
(crossbelow(cci(22), 120))
FILTER 12
ENTRY:
// Chaikin Money Flow Divergence: 1 (Primary)
(diverge(cmf(8), mov(close, 3, simple), 4, 15) = 1)
EXIT:
// MACD Divergence: 1 (Primary)
(diverge(macd(), mov(close, 3, simple), 7, 17) = -1)
FILTER 13
ENTRY:
// Money Flow Index Divergence: 1
(diverge(mfi(5), mov(close, 3, simple), 0, 3) = 1)
EXIT:
// TEMA: 2
(crossabove(tema(close, 13), tema(close, 50))) or
// Long Stop Loss / Short Stop Gain (Supporting Exit)
(stopdown(25))
FILTER 14
ENTRY:
// Stochastics %K Signal: 1
(crossabove(stochk(7, 3), 27)) and
// Chaikin Money Flow - Stock: 1
(cmf(11) > 0) and
// Accumulation/Distribution - Sector Periods: 1 (Supporting Entry and Exit)
(sector("XIV", mov(ad(), 10, simple)) > sector("XIV", ref(mov(ad(), 10, simple), -1)))
EXIT:
// TEMA: 2
// Stochastics %K Signal: 1
(crossbelow(stochk(7, 3), 67)) or
// Accumulation/Distribution - Sector Periods: 1 (Supporting Entry and Exit)
(sector("XIV", mov(ad(), 10, simple)) < sector("XIV", ref(mov(ad(), 10, simple), -1))))
FILTER 15
ENTRY:
// Negative Volume Index: 2
(crossbelow(nvi(), mov(nvi(), 8, simple))) and
// Price and Volume Trend Divergence - Market Pds: 2
(sector($curexchange, close) <> sector($curexchange, low(close, 45)) or
sector($curexchange, pvt()) = sector($curexchange, low(pvt(), 45))) and
// Stochastic Momentum Divergence - Market Pds: 2
(sector($curexchange, diverge(smi(15, 8, 8), mov(close, 3, simple), 2, 5)) <> 1)
EXIT:
// Negative Volume Index: 2
(crossabove(nvi(), mov(nvi(), 8, simple))) or
// Price and Volume Trend Divergence - Market Pds: 2
(sector($curexchange, close) = sector($curexchange, low(close, 45)) and
sector($curexchange, pvt()) <> sector($curexchange, low(pvt(), 45))) or
// Stochastic Momentum Divergence - Market Pds: 2
(sector($curexchange, diverge(smi(15, 8, 8), mov(close, 3, simple), 2, 5)) = 1)
FILTER 16
ENTRY:
// Negative Volume Index: 2
(crossbelow(nvi(), mov(nvi(), 5, simple))) and
// Price and Volume Trend Divergence - Market Pds: 1
(sector($curexchange, close) <> sector($curexchange, high(close, 70)) or
sector($curexchange, pvt()) = sector($curexchange, high(pvt(), 70))) and
// Stochastics %K Divergence - Market Periods: 2
(sector($curexchange, diverge(stochk(13, 5), mov(close, 3, simple), 7, 17)) <> 1) and
// Chande Momentum Oscillator - Sector OB/OS: 2
(sector("XIV", cmo(17)) < sector("XIV", mov(cmo(17), 5, simple)))
EXIT:
/// Negative Volume Index: 2
(crossabove(nvi(), mov(nvi(), 5, simple))) or
// Price and Volume Trend Divergence - Market Pds: 1
(sector($curexchange, close) = sector($curexchange, high(close, 70)) and
sector($curexchange, pvt()) <> sector($curexchange, high(pvt(), 70))) or
// Stochastics %K Divergence - Market Periods: 2
(sector($curexchange, diverge(stochk(13, 5), mov(close, 3, simple), 7, 17)) = 1)
FILTER 17
ENTRY:
// Stochastics Crossover: 1
(crossabove(stochk(5, 4), stochd(5, 4, 5, simple))) and
// Chaikins Volatility - Low Sector: HB
(numsymbols("XIV", vch(7, 7) < mov(vch(7, 7), 25, simple)) /
totsymbols("XIV") > 0.3)
EXIT:
// MACD: 2
(crossabove(macd(), mov(macd(), 17, exponential)))
FILTER 18
ENTRY:
// Chaikin Money Flow Divergence: 2
(diverge(cmf(14), mov(close, 3, simple), 2, 7) = -1) and
// Linear Regression Indicator - Stock Periods: 1
(close < lri(close, 20) * 1.03) and
// Money Flow Index Divergence - Market Periods: 2
(sector($curexchange, diverge(mfi(23), mov(close, 3, simple), 2, 7)) <> 1) and
// Chande Momentum Oscillator - Sector: 1 (Supporting Entry)
(abs(sector("XIV", cmo(17))) > 0) and
// Relative Momentum Divergence - Market Periods: 1 (Supporting Entry and Exit)
(sector($curexchange, diverge(rmi(18, 4), mov(close, 3, simple), 1, 3)) <> -1)
EXIT:
// Chaikin Money Flow Divergence: 2
(diverge(cmf(14), mov(close, 3, simple), 2, 7) = 1) or
// Linear Regression Indicator - Stock Periods: 1
(close > lri(close, 20) * 1.03) or
// Money Flow Index Divergence - Market Periods: 2
(sector($curexchange, diverge(mfi(23), mov(close, 3, simple), 2, 7)) = 1) or
// Relative Momentum Divergence - Market Periods: 1 (Supporting Entry and Exit)
(sector($curexchange, diverge(rmi(18, 4), mov(close, 3, simple), 1, 3)) = -1)
FILTER 19
ENTRY:
// Bollinger Bands: 2
(close > bbl(close, 19, 2)) and
// Chaikin Money Flow - Sector: 2
(sector("XIV", cmf(8)) < 0)
EXIT:
// MACD Divergence: 1
(diverge(macd(), mov(close, 3, simple), 5, 13) = -1) or
// Long Stop Loss / Short Stop Gain (Supporting Exit)
(stopdown(20))
FILTER 20
ENTRY:
// TRIX: 2 (Primary)
(decreasing(trix(close, 13))) and
// Stochastics %D Divergence - Sector Periods: 2 (Supporting Entry and Exit)
(sector("XIV", diverge(stochd(13, 5, 3, simple), mov(close, 3, simple), 2, 15)) <> 1) and
// Chaikins Volatility - Low Stock Periods (Supporting Entry and Exit)
(vch(7, 7) < mov(vch(7, 7), 15, simple))
EXIT:
// TRIX: 2 (Primary)
(increasing(trix(close, 13))) or
// Stochastics %D Divergence - Sector Periods: 2 (Supporting Entry and Exit)
(sector("XIV", diverge(stochd(13, 5, 3, simple), mov(close, 3, simple), 2, 15)) = 1) or
// Chaikins Volatility - Low Stock Periods (Supporting Entry and Exit)
(vch(7, 7) > mov(vch(7, 7), 15, simple))
FILTER 21
ENTRY:
// Qstick Crossover: 2
(crossbelow(qst(12), 0)) and
// Accumulation/Distribution - Sector: 1
(sector("XIV", mov(ad(), 35, simple)) > sector("XIV", ref(mov(ad(), 35, simple), -1)))
EXIT:
// Qstick Crossover: 2
(crossabove(qst(12), 0))
FILTER 22
ENTRY:
// Dynamic Momentum Divergence: 1
(diverge(dmi(), mov(close, 3, simple), 1, 11) = 1)
EXIT:
// DEMA: 2
(crossabove(dema(close, 13), dema(close, 21))) or
// Long Stop Loss / Short Stop Gain (Supporting Exit)
(stopdown(15))
FILTER 23
ENTRY:
// Linear Regression Indicator: 2
(crossbelow(close, lri(close, 20) * 0.97)) and
// R-Squared - Sector (Supporting Entry)
(sector("XIV", rsq(close, 20)) > .20)
EXIT:
// DEMA: 2
// Linear Regression Indicator: 2
(crossabove(close, lri(close, 20) * 0.97))
FILTER 24
ENTRY:
// Momentum: 2
(crossbelow(mom(close, 5), mov(mom(close, 5), 13, exponential))) and
// Relative Momentum Divergence - Market Periods: 1
(sector($curexchange, diverge(rmi(6, 14), mov(close, 3, simple), 1, 7)) <> -1) and
// Projection Oscillator Divergence - Sector: 2
(sector("XIV", diverge(pjo(8), mov(close, 3, simple), 6, 17)) = -1) and
// STIX - Market Periods: 2
(stix($curexchange) > 52)
EXIT:
// Momentum: 2
(crossabove(mom(close, 5), mov(mom(close, 5), 13, exponential))) or
// Relative Momentum Divergence - Market Periods: 1
(sector($curexchange, diverge(rmi(6, 14), mov(close, 3, simple), 1, 7)) = -1) or
// STIX - Market Periods: 2
(stix($curexchange) < 45)
FILTER 25
ENTRY:
// Qstick Crossover: 2
(crossbelow(qst(8), 0)) and
// Accumulation/Distribution - Stock: 1
(mov(ad(), 30, simple) > ref(mov(ad(), 30, simple), -1)) and
// TRIX - Sector: 1 (Supporting Entry)
(sector("XIV", trix(close, 5)) > sector("XIV", mov(trix(close, 5), 50, simple)))
EXIT:
// Qstick Crossover: 2
(crossabove(qst(8), 0))
FILTER 26
ENTRY:
/ Momentum: 2
(crossbelow(mom(close, 5), mov(mom(close, 5), 7, exponential))) and
// Relative Momentum Divergence - Market Periods: 1
(sector($curexchange, diverge(rmi(20, 20), mov(close, 3, simple), 2, 5)) <> -1) and
// Projection Oscillator Divergence - Sector: 2
(sector("XIV", diverge(pjo(11), mov(close, 3, simple), 1, 15)) = -1) and
// STIX - Market Periods: 2
(stix($curexchange) > 50)
EXIT:
// Momentum: 2
(crossabove(mom(close, 5), mov(mom(close, 5), 7, exponential))) or
// Relative Momentum Divergence - Market Periods: 1
(sector($curexchange, diverge(rmi(20, 20), mov(close, 3, simple), 2, 5)) = -1) or
// STIX - Market Periods: 2
(stix($curexchange) < 42)
FILTER 27
ENTRY:
// Qstick Divergence: 2
(diverge(qst(8), mov(close, 3, simple), 2, 13) = -1) and
// Momentum - Sector Periods: 2
(sector("XIV", mom(close, 5)) < sector("XIV", mov(mom(close, 5), 5, exponential))) and
// Relative Momentum Index - Sector: 2 (Supporting Entry)
(sector("XIV", rmi(12, 16)) > 89)
EXIT:
// Qstick Divergence: 2
(diverge(qst(8), mov(close, 3, simple), 2, 13) = 1) or
// Momentum - Sector Periods: 2
(sector("XIV", mom(close, 5)) > sector("XIV", mov(mom(close, 5), 5, exponential))) or
// Long Stop Loss / Short Stop Gain (Supporting Exit)
(stopdown(10))
FILTER 28
ENTRY:
// Qstick Crossover: 2
(crossbelow(qst(18), 0)) and
// Stochastics %D - Sector Periods: 2
(sector("XIV", stochd(13, 4, 7, simple)) > 36) and
// MACD Divergence - Market Periods: 2 (Supporting Entry and Exit)
(sector($curexchange, diverge(macd(), mov(close, 3, simple), 8, 15)) <> 1)
EXIT:
// Qstick Crossover: 2
(crossabove(qst(18), 0)) or
// Stochastics %D - Sector Periods: 2
(crossabove(sector("XIV", stochd(13, 4, 7, simple)), 36)) or
// MACD Divergence - Market Periods: 2 (Supporting Entry and Exit)
(sector($curexchange, diverge(macd(), mov(close, 3, simple), 8, 15)) = 1)
FILTER 29
ENTRY:
// Intraday Momentum Divergence: 2
(diverge(imi(13), mov(close, 3, simple), 2, 7) = -1) and
// Momentum Divergence - Stock Periods: 1
(close <> high(close, 35) or mom(close, 13) = high(mom(close, 13), 35)) and
// Stochastics %D - Market Periods: 2 (Supporting Entry and Exit)
(sector($curexchange, stochd(7, 3, 9, simple)) > 18) and
// Ease Of Movement - Sector: 1 (Supporting Entry)
(sector("XIV", mov(eom(17), 9, simple)) > 0)
EXIT:
// Intraday Momentum Divergence: 2
(diverge(imi(13), mov(close, 3, simple), 2, 7) = 1) or
// Momentum Divergence - Stock Periods: 1
(close = high(close, 35) and mom(close, 13) <> high(mom(close, 13), 35)) or
// Stochastics %D - Market Periods: 2 (Supporting Entry and Exit)
(crossabove(sector($curexchange, stochd(7, 3, 9, simple)), 18))
FILTER 30
ENTRY:
// Chaikin Money Flow Divergence: 2
(diverge(cmf(5), mov(close, 3, simple), 5, 15) = -1) and
// Projection Bands - Market
(sector($curexchange, pbu(19)-pbl(19)) < sector($curexchange, mov(pbu(19)-pbl(19), 19, simple))) and
// Stochastics Crossover - Stock Periods: 2
(stochk(5, 1) < stochd(5, 1, 9, simple)) and
// StrataSearch Volatility - Low Stock (Supporting Entry)
(svi(close, 15, 180) < 11)
EXIT:
// Chaikin Money Flow Divergence: 2
(diverge(cmf(5), mov(close, 3, simple), 5, 15) = 1) or
// Stochastics Crossover - Stock Periods: 2
(stochk(5, 1) > stochd(5, 1, 9, simple))
Happy to share this with folks here - no reason for us not to help each other. Just email me here and I will send you these files. Note that you will need to download XIV data and create a new Sector called "XIV" for this to work properly. Once that is done, use the scheduler function to set up a nightly import of data and to have the signals run automatically and sent to you via email. I usually wait until around 11 PM to import the data and run the signals. All trades are bought and sold at the open on the day following the signal being generated.
Good luck!!
|