TTF - Trend Trigger Factor

Modified on 2008/06/04 17:40 by Administrator — Categorized as: TASCIndicators

Syntax

public TTF(Bars ds, int period, string description)
public static TTF Series(Bars ds, int period)
public static double Value(int bar, Bars ds, int period)

Parameter Description

Bars The symbol's Bars object
period Indicator period

Description

Trend Trigger Factor from the December 2004 issue of Stocks & Commodities magazine.

TTF provides an indication of trend direction by measuring the differences between the highest high and lowest low of the current and previous Periods; arriving at an oscillatory-type indicator whose value exceeds 100 when an uptrend is confirmed and -100 for a downtrend. Using TTF alone for entries and exits will subject a trading system to frequent whipsaws for non-trending markets.

Example

Here's the basic system from the magazine article.

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() { const int period = 15; DataSeries ttf = TTF.Series(Bars, period); ChartPane cp = CreatePane( 40, true, true ); DrawHorzLine(cp, 100, Color.Gray, LineStyle.Dotted, 1); DrawHorzLine(cp, -100, Color.Gray, LineStyle.Dotted, 1); PlotSeries(cp, ttf, Color.Blue, LineStyle.Solid, 2); HideVolume(); for (int bar = period; bar < Bars.Count; bar++) { switch ((int)MarketPosition) { case 1: if( CrossUnder(bar, ttf, -100) ) { SellAtMarket(bar + 1, LastPosition); ShortAtMarket(bar + 1); } break; case -1: if( CrossOver(bar, ttf, 100) ) { CoverAtMarket(bar + 1, LastPosition); BuyAtMarket(bar + 1); } break; default: if( CrossOver(bar, ttf, 100) ) BuyAtMarket(bar + 1); else if( CrossUnder(bar, ttf, -100) ) ShortAtMarket(bar + 1); break; } } } } }