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