DataSeries TII( DataSeries ds, int period, int ma_period )
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;namespace WealthLab.Strategies { public class TII_Strategy : WealthScript { protected override void Execute() { TII tii = TII.Series( Close,30,60 ); ChartPane tiiPane = CreatePane( 30,true,true ); PlotSeries( tiiPane, tii, Color.Blue, LineStyle.Solid, 2 ); DrawHorzLine( tiiPane, 20.0, Color.Red, LineStyle.Dashed, 1 ); DrawHorzLine( tiiPane, 80.0, Color.Blue, LineStyle.Dashed, 1 ); for(int bar = 60; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if ( bar+1 - p.EntryBar >= 10 ) ExitAtMarket( bar+1, p, "Exit after 10 days" ); } else { // Buy when TII crosses above 80 if( CrossOver( bar, tii, 80.0 ) ) BuyAtMarket( bar + 1, "tiiTurnedUp" ); // Short when TII crosses below 20 if( CrossUnder( bar, tii, 20.0 ) ) ShortAtMarket( bar + 1, "tiiTurnedDown" ); } } } } }