(Update 29 Dec 2009: There is a bug in the current build of TOS which makes the Vervoort Crossover lines go ape at the beginning of the chart. Commenting out the line signal.assignValueColor(if buySignal then color.green else color.red); appears to fix the problem….for now. – Eric
Thanks to Reader Randy H. for suggesting this one. In his article “The Quest For Reliable Crossovers” (Stocks & Commodities Magazine, May 2008) author Sylvain Vervoort sets forth a trading method using the crosses of two unique moving averages. Specifically, he used a zero-lag triple exponential moving average of 1) the typical price (h+l+c)/3 and 2) the Heikin-Ashi close. He successfully backtested his method on 211 stocks and found using a 55 period average on daily charts was optimal.
# VervoortCrossover # (c) 2009 http://www.thinkscripter.com # thinkscripter@gmail.com # Last Update 30 MAR 2009 input period = 55; def price = (high+low+close)/3; #-----Typical Price ZeroLag Triple Exponential Moving Average def TMA1 = 3*expAverage(price,period) -3*expAverage(expAverage(price,period),period) +expAverage(expAverage(expAverage(price,period) ,period),period); def TMA2 = 3*expAverage(TMA1,period) -3*expAverage(expAverage(TMA1,period),period) +expAverage(expAverage(expAverage(TMA1,period) ,period),period); def difference = TMA1-TMA2; plot TypicalPriceZeroLagTEMA = TMA1+difference; TypicalPriceZeroLagTEMA.setDefaultColor(color.green); #------Heikin-Ashi Close ZeroLag Triple Exponential Moving Average rec haopen = CompoundValue(1,((open[1]+high[1] +low[1]+close[1])/4 + haopen[1])/2, hl2); def haclose = ((open+high+low+close)/4+haopen +max(high,haopen)+min(low,haopen))/4; def HATMA1 = 3*expAverage(haclose,period) -3*expAverage(expAverage(haclose,period),period) +expAverage(expAverage(expAverage(haclose,period) ,period),period); def HATMA2 = 3 * ExpAverage(HATMA1, period) - 3 * ExpAverage(ExpAverage(HATMA1, period), period) + ExpAverage(ExpAverage(ExpAverage(HATMA1, period) , period), period); def HAdifference = HATMA1 - HATMA2; plot HeikinAshiZeroLagTEMA = HATMA1 + HAdifference; HeikinAshiZeroLagTEMA.setDefaultColor(color.red); def buySignal = if TypicalPriceZeroLagTEMA > HeikinAshiZeroLagTEMA and TypicalPriceZeroLagTEMA[1] <= HeikinAshiZeroLagTEMA[1] then 1 else 0; def sellSignal = if TypicalPriceZeroLagTEMA < HeikinAshiZeroLagTEMA and TypicalPriceZeroLagTEMA[1] >= HeikinAshiZeroLagTEMA[1] then 1 else 0; plot signal = if buySignal or sellSignal then TypicalPriceZeroLagTEMA else double.nan; #signal.assignValueColor(if buySignal then color.green else color.red); signal.setLineWeight(5); signal.SetStyle(curve.points);






Thanks so much ThinkScripter!
Donation sent.
If you find this script useful to you, please show your support to ThinkScripter, he is a valuable resource for us TOS users.
Thanks for the scripts. I will send the donation. Is there any way one can backtest these strategies. Any pointers will be appreciated.
Eric,
I too would appreciate an example of how to bake this into a strategy. I tried doing it with the Multi-stops study and couldn’t seem to make it work. An example of how to call a study from a strategy would really help. I know this is simple for you… sorry for being so dense. I guess I’m a trader, not a programmer… but I’m learning.
Bill
This is excellent. I was just looking at the Heikin-Ashi candles tonight for short timeframe trading and this appears to test very well as a confirmation signal with other indicators which you have developed for me, even on shorter timeframes. What is most interesting is that it appears to provide a signal in advance of some pattern recognition. Really cool. Thanks!
Eric – Thanks again for this! Is there anyway to modify this so that the signal changes color on the tema crossovers up and down? I realize that Heikin-Ashi are generally suggested for longer time frames but this is putting out some good confirm signals this morning along with pattern recognition. However, it is putting out a lot of signals on tick charts and so you have to go back and look at the last several signals to get a sense of direction. Thanks.
Excellent. Thanks! I have a couple of ideas I may shoot over to you in a day or two for consideration.
Hey Eric,
I’ve seen a study elsewhere that threw similar “dot” signals and they originally were white too, but got changed in an update to red or green depending on the intended signal. This can help eliminate confusion when multiple signals are thrown consecutively when price action is choppy… just a thought. As always, great work.
Yes, I changed the white to red/green about a week after I published this…never got around to updating the code here as I posted the updated version in the forum. Fixed now.
Eric
Eric, Thanks a million!
You saved me the huge trouble of converting this from EasyLanguage to thinkscript.
What would be the simplest way to have it test for the crossover pointts from BUY to SELL and announce them with PLOT(“PlaySound.xxxx”) and trigger a popup alert so we don’t have to sit and watch it? Any help greatly appreciated.
ToS platform now lets me add user-defined .WAV files for price alerts , so I could probably be across the room and hear it say “Vervoort Crossover on Crude Oil!” instead of just the built-in telephone RING and having to see which chart it’s on.
David,
The alert() command in thinkScript can be used to play an audible alert on an active chart. However, last I looked, you only had a pre-defined set of sounds to choose from.
Eric
I was referred to your site by TD Amer. New to thinkscript. Considering enrolling. When I examine your free to use examples does one simply copy and paste. If so I do get numerous error issues. Any help when convenient is appreciated.
thanks
mark
ie
No such function: setDefaultColor at 18:25
No such variable: signal at 46:6
Incompatible parameter
Mark,
Looks like you might be trying to paste the code into a blank Strategy and not a blank Study…there is a difference. Also make sure you are using the built in copy and paste icons in the upper right of the code windows on my site.
Eric
Jain,
You can contruct a ToS strategy from any study. In this case you will need to set up code for a binary condition that is true when one moving average crosses the other. Then, using the addOrder(condition, price) command, you have created a strategy. I’ll publish the Vervoort Crossover strategy tonight for folks to play with.
Eric
Coming soon to a theater near you!
-Eric
Steve,
Change the third to last line to:
signal.assignValueColor(if buySignal then color.green else color.red);