Syntax
public RevEngSMA_TC(DataSeries ds, int period1, int period2, string description)
public static RevEngSMA_TC Series(DataSeries ds, int period1, int period2)
Parameter Description
ds |
Source Series |
period1 |
Period for SMA #1
|
period2 |
Period for SMA #2 |
Description
The RevEngSMA_TC indicator derived by Tsokakis in the February 2007 issue of
Stocks & Commodities magazine solves for the value of "Tomorrow's Close" (i.e., the Source Series) at which two
SMAs with
period1 and
period2 would be equal.
Tsokakis observed and demonstrated that crossovers of this indicator with its source series occurred one bar earlier than crossovers of the two
SMA indicators using the same periods a very high percentage of the time.
Example
This example demonstrates that the RevEngSMA_TC DataSeries crosses over/under its source series prior to the crossing of the SMAs a very high percentage of the time (probably over 90%).
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
LineStyle LS = LineStyle.Solid;
DataSeries tc = RevEngSMA_TC.Series(Close, 20, 50);
DataSeries sma1 = SMA.Series(Close, 20);
DataSeries sma2 = SMA.Series(Close, 50);
ChartPane tcPane = CreatePane( 50, true, true );
// Plot the Close with the RevEngSMA_TC to observe the crossovers
PlotSeries(tcPane, Close, Color.Black, LS, 1);
PlotSeries(tcPane, tc, Color.Blue, LS, 1);
// Plot the SMAs as you normally would in the PricePane
PlotSeries(PricePane, sma1, Color.Green, LS, 1);
PlotSeries(PricePane, sma2, Color.Red, LS, 1);
// Highlight the crossovers of Close and RevEngSMA_TC
for (int bar = 50; bar < Bars.Count; bar++)
{
if( CrossOver(bar, Close, tc) || CrossUnder(bar, Close, tc) )
SetBackgroundColor(bar, Color.Beige);
}
}
}
}