(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
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);